Skip to content

Commit

Permalink
chore: fix naming of parameters sourceID/destinationID (#7448)
Browse files Browse the repository at this point in the history
* Add OnAcknowledgmentPacket to IBCModule V2 Interface

* chore: fix typo

* chore: PR feedback

* chore: fix wrong merge conflict resolution
  • Loading branch information
bznein authored Oct 14, 2024
1 parent a539936 commit a282c1a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
16 changes: 8 additions & 8 deletions modules/core/api/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,35 @@ type IBCModule interface {
// for this specific application.
OnSendPacket(
ctx context.Context,
sourceID string,
destinationID string,
sourceChannel string,
destinationChannel string,
sequence uint64,
data channeltypesv2.PacketData,
signer sdk.AccAddress,
) error

OnRecvPacket(
ctx context.Context,
sourceID string,
destinationID string,
sourceChannel string,
destinationChannel string,
data channeltypesv2.PacketData,
relayer sdk.AccAddress,
) channeltypesv2.RecvPacketResult

// OnTimeoutPacket is executed when a packet has timed out on the receiving chain.
OnTimeoutPacket(
ctx context.Context,
sourceID string,
destinationID string,
sourceChannel string,
destinationChannel string,
data channeltypesv2.PacketData,
relayer sdk.AccAddress,
) error

// OnAcknowledgementPacket is executed when a packet gets acknowledged
OnAcknowledgementPacket(
ctx context.Context,
sourceID string,
destinationID string,
sourceChannel string,
destinationChannel string,
data channeltypesv2.PacketData,
acknowledgement []byte,
relayer sdk.AccAddress,
Expand Down
8 changes: 4 additions & 4 deletions testing/mock/v2/ibc_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
)

type IBCApp struct {
OnSendPacket func(ctx context.Context, sourceID string, destinationID string, sequence uint64, data channeltypesv2.PacketData, signer sdk.AccAddress) error
OnRecvPacket func(ctx context.Context, sourceID string, destinationID string, data channeltypesv2.PacketData, relayer sdk.AccAddress) channeltypesv2.RecvPacketResult
OnTimeoutPacket func(ctx context.Context, sourceID string, destinationID string, data channeltypesv2.PacketData, relayer sdk.AccAddress) error
OnAcknowledgementPacket func(ctx context.Context, sourceID string, destinationID string, data channeltypesv2.PacketData, acknowledgement []byte, relayer sdk.AccAddress) error
OnSendPacket func(ctx context.Context, sourceChannel string, destinationChannel string, sequence uint64, data channeltypesv2.PacketData, signer sdk.AccAddress) error
OnRecvPacket func(ctx context.Context, sourceChannel string, destinationChannel string, data channeltypesv2.PacketData, relayer sdk.AccAddress) channeltypesv2.RecvPacketResult
OnTimeoutPacket func(ctx context.Context, sourceChannel string, destinationChannel string, data channeltypesv2.PacketData, relayer sdk.AccAddress) error
OnAcknowledgementPacket func(ctx context.Context, sourceChannel string, destinationChannel string, data channeltypesv2.PacketData, acknowledgement []byte, relayer sdk.AccAddress) error
}
16 changes: 8 additions & 8 deletions testing/mock/v2/ibc_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,33 +32,33 @@ func NewIBCModule() IBCModule {
}
}

func (im IBCModule) OnSendPacket(ctx context.Context, sourceID string, destinationID string, sequence uint64, data channeltypesv2.PacketData, signer sdk.AccAddress) error {
func (im IBCModule) OnSendPacket(ctx context.Context, sourceChannel string, destinationChannel string, sequence uint64, data channeltypesv2.PacketData, signer sdk.AccAddress) error {
if im.IBCApp.OnSendPacket != nil {
return im.IBCApp.OnSendPacket(ctx, sourceID, destinationID, sequence, data, signer)
return im.IBCApp.OnSendPacket(ctx, sourceChannel, destinationChannel, sequence, data, signer)
}
return nil
}

func (im IBCModule) OnRecvPacket(ctx context.Context, sourceID string, destinationID string, data channeltypesv2.PacketData, relayer sdk.AccAddress) channeltypesv2.RecvPacketResult {
func (im IBCModule) OnRecvPacket(ctx context.Context, sourceChannel string, destinationChannel string, data channeltypesv2.PacketData, relayer sdk.AccAddress) channeltypesv2.RecvPacketResult {
if im.IBCApp.OnRecvPacket != nil {
return im.IBCApp.OnRecvPacket(ctx, sourceID, destinationID, data, relayer)
return im.IBCApp.OnRecvPacket(ctx, sourceChannel, destinationChannel, data, relayer)
}
return channeltypesv2.RecvPacketResult{
Status: channeltypesv2.PacketStatus_Success,
Acknowledgement: mockv1.MockPacketData,
}
}

func (im IBCModule) OnAcknowledgementPacket(ctx context.Context, sourceID string, destinationID string, data channeltypesv2.PacketData, acknowledgement []byte, relayer sdk.AccAddress) error {
func (im IBCModule) OnAcknowledgementPacket(ctx context.Context, sourceChannel string, destinationChannel string, data channeltypesv2.PacketData, acknowledgement []byte, relayer sdk.AccAddress) error {
if im.IBCApp.OnAcknowledgementPacket != nil {
return im.IBCApp.OnAcknowledgementPacket(ctx, sourceID, destinationID, data, acknowledgement, relayer)
return im.IBCApp.OnAcknowledgementPacket(ctx, sourceChannel, destinationChannel, data, acknowledgement, relayer)
}
return nil
}

func (im IBCModule) OnTimeoutPacket(ctx context.Context, sourceID string, destinationID string, data channeltypesv2.PacketData, relayer sdk.AccAddress) error {
func (im IBCModule) OnTimeoutPacket(ctx context.Context, sourceChannel string, destinationChannel string, data channeltypesv2.PacketData, relayer sdk.AccAddress) error {
if im.IBCApp.OnTimeoutPacket != nil {
return im.IBCApp.OnTimeoutPacket(ctx, sourceID, destinationID, data, relayer)
return im.IBCApp.OnTimeoutPacket(ctx, sourceChannel, destinationChannel, data, relayer)
}
return nil
}

0 comments on commit a282c1a

Please sign in to comment.