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: amend event emitted for create channel to include client identifier #7557

Merged
merged 1 commit into from
Nov 12, 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
5 changes: 3 additions & 2 deletions modules/core/04-channel/v2/keeper/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ func EmitWriteAcknowledgementEvents(ctx context.Context, packet types.Packet, ac
// TODO: https://github.com/cosmos/ibc-go/issues/7386
}

// EmitCreateChannelEvent emits a channel create event.
func (*Keeper) EmitCreateChannelEvent(ctx context.Context, channelID string) {
// emitCreateChannelEvent emits a channel create event.
func (*Keeper) emitCreateChannelEvent(ctx context.Context, channelID, clientID string) {
sdkCtx := sdk.UnwrapSDKContext(ctx)

sdkCtx.EventManager().EmitEvents(sdk.Events{
sdk.NewEvent(
types.EventTypeCreateChannel,
sdk.NewAttribute(types.AttributeKeyChannelID, channelID),
sdk.NewAttribute(types.AttributeKeyClientID, clientID),
),
sdk.NewEvent(
sdk.EventTypeMessage,
Expand Down
2 changes: 1 addition & 1 deletion modules/core/04-channel/v2/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (k *Keeper) CreateChannel(goCtx context.Context, msg *types.MsgCreateChanne
k.SetCreator(ctx, channelID, msg.Signer)
k.SetNextSequenceSend(ctx, channelID, 1)

k.EmitCreateChannelEvent(goCtx, channelID)
k.emitCreateChannelEvent(goCtx, channelID, msg.ClientId)

return &types.MsgCreateChannelResponse{ChannelId: channelID}, nil
}
Expand Down
1 change: 1 addition & 0 deletions modules/core/04-channel/v2/types/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
// IBC channel events
const (
AttributeKeyChannelID = "channel_id"
AttributeKeyClientID = "client_id"
)

// IBC channel events vars
Expand Down
Loading