-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
ibc: async acknowledgements #7361
Conversation
Codecov Report
@@ Coverage Diff @@
## master #7361 +/- ##
==========================================
+ Coverage 54.96% 54.99% +0.02%
==========================================
Files 588 588
Lines 36631 36664 +33
==========================================
+ Hits 20135 20163 +28
- Misses 14406 14409 +3
- Partials 2090 2092 +2 |
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.
LGTM, left mostly typo fixes and nits
// is the case. | ||
if ack != nil { | ||
if err := k.ChannelKeeper.WriteAcknowledgement(ctx, msg.Packet, ack); err != nil { | ||
return nil, err |
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.
test case?
Co-authored-by: colin axnér <[email protected]>
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.
Nice work!! Think there's some issues with how packet receipt is being processed
x/ibc/04-channel/keeper/packet.go
Outdated
if channel.Ordering == types.UNORDERED { | ||
switch channel.Ordering { | ||
case types.UNORDERED: | ||
// check if the packet acknowledgement has been received already for unordered channels | ||
_, found := k.GetPacketAcknowledgement(ctx, packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence()) |
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.
Shouldn't we be checking for packet receipts now instead of packet acknowledgements?
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.
Yes, this needs to be changed, per the spec - https://github.com/cosmos/ics/tree/master/spec/ics-004-channel-and-packet-semantics#receiving-packets
@@ -280,15 +280,6 @@ func (suite *KeeperTestSuite) TestRecvPacket() { | |||
_, _, _, _, channelA, channelB := suite.coordinator.Setup(suite.chainA, suite.chainB, types.UNORDERED) | |||
packet = types.NewPacket(validPacketData, 1, channelA.PortID, channelA.ID, channelB.PortID, channelB.ID, disabledTimeoutHeight, uint64(suite.chainB.GetContext().BlockTime().UnixNano())) | |||
}, false}, | |||
{"acknowledgement already received", func() { |
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.
should be replaced by receipt already written
test case
} | ||
|
||
// commit changes | ||
chain.App.Commit() |
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.
Is doing this ok? @colin-axner
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.
I think this is ok as it represents the asynchrony of the acknowledgment?
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.
it's ok because no message is being sent to the chain (we are simulating one) and this function is called by the coordinator which immediately increments time afterwards. It isn't great design though (my bad) because it is counter-intuitive. It must be done though because otherwise the state change won't be updated on the client
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.
Thanks; see comments.
x/ibc/04-channel/keeper/packet.go
Outdated
if channel.Ordering == types.UNORDERED { | ||
switch channel.Ordering { | ||
case types.UNORDERED: | ||
// check if the packet acknowledgement has been received already for unordered channels | ||
_, found := k.GetPacketAcknowledgement(ctx, packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence()) |
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.
Yes, this needs to be changed, per the spec - https://github.com/cosmos/ics/tree/master/spec/ics-004-channel-and-packet-semantics#receiving-packets
Co-authored-by: Aditya <[email protected]>
…sdk into fedekunze/7254-async-acks
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.
ACK, Nice work!!!
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.
ACK, nice work 👍
Description
closes: #7254
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerCodecov Report
in the comment section below once CI passes