-
Notifications
You must be signed in to change notification settings - Fork 641
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
use new port router with OnAcknowledgementPacket #7108
Changes from 5 commits
210e801
97c6b76
60826e5
f696ae6
01b64e5
623afd2
a3ad8d3
a451b5c
431f804
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -234,13 +234,32 @@ func (LegacyIBCModule) OnRecvPacket( | |
} | ||
|
||
// OnAcknowledgementPacket implements the IBCModule interface | ||
func (LegacyIBCModule) OnAcknowledgementPacket( | ||
func (im *LegacyIBCModule) OnAcknowledgementPacket( | ||
ctx sdk.Context, | ||
channelVersion string, | ||
packet channeltypes.Packet, | ||
acknowledgement []byte, | ||
relayer sdk.AccAddress, | ||
) error { | ||
for i := len(im.cbs) - 1; i >= 0; i-- { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this ended up looking super clean with these 2 interfaces for wrapping, nice job! |
||
var ( | ||
cbVersion = channelVersion | ||
cbAck = acknowledgement | ||
) | ||
|
||
if wrapper, ok := im.cbs[i].(VersionWrapper); ok { | ||
cbVersion, channelVersion = wrapper.UnwrapVersionSafe(ctx, packet.SourcePort, packet.SourceChannel, cbVersion) | ||
} | ||
|
||
if wrapper, ok := im.cbs[i].(AcknowledgementWrapper); ok { | ||
cbAck, acknowledgement = wrapper.UnwrapAcknowledgement(ctx, packet.SourcePort, packet.SourceChannel, cbAck) | ||
} | ||
|
||
err := im.cbs[i].OnAcknowledgementPacket(ctx, cbVersion, packet, cbAck, relayer) | ||
if err != nil { | ||
return errorsmod.Wrap(err, "acknowledge packet callback failed") | ||
} | ||
} | ||
return nil | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -136,7 +136,11 @@ type VersionWrapper interface { | |
// UnwrapVersionUnsafe will be used during opening handshakes and channel upgrades when the version | ||
// is still being negotiated. | ||
UnwrapVersionUnsafe(string) (cbVersion, underlyingAppVersion string, err error) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can add a type assertion for ics27 |
||
// UnwrapVersionSafe(ctx sdk.Context, portID, channelID, version string) (appVersion, version string) | ||
UnwrapVersionSafe(ctx sdk.Context, portID, channelID, version string) (cbVersion, underlyingAppVersion string) | ||
colin-axner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
type AcknowledgementWrapper interface { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can add a type assertion for ics29 |
||
UnwrapAcknowledgement(ctx sdk.Context, portID, channelID string, acknowledgment []byte) (cbAcknowledgement, underlyingAppAcknowledgement []byte) | ||
colin-axner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
// UpgradableModule defines the callbacks required to perform a channel upgrade. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: we return ack we unmarshaled as our ack. This is because it expects to unmarshal this value in
OnAcknowledgement