-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Fix QueryUnreceivedPackets/Acks #7320
Conversation
Not exactly sure what all the other proto changes are about. I reran Also
EDIT: Fixed by reverting to Makefile before proto-tools script. Everything works now except proto-format still gives me the above issue |
do you have the correct versions installed? |
|
||
// if packet commitment still exists on the original sending chain, then packet ack has not been received | ||
// since processing the ack will delete the packet commitment | ||
if commitment := q.GetPacketCommitment(ctx, req.PortId, req.ChannelId, seq); len(commitment) != 0 { |
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.
This differs from the godoc
// Given a list of counterparty packet commitments, the querier checks if the packet
// has already been received by checking if an acknowledgement exists on this
// chain for the packet sequence.
It seems the implemented flow here is trying to take in a list of acknowledgement sequences and check if the packet commitment exists to see the ack needs to be relayed? How does a relayer determine which acknowledgement sequences to send? Unlike packet commitments, acknowledgements live forever so a relayer would have to already know which acknowledgements have not been acknowledged on the original chain, which is the purpose of this function.
The previous flow is to use the receiving chain as the indicator. A packet has 3 life cycles:
- sent but not received
- received but not ack'd
- ack'd and deleted
The sender chain indicates if the packet is in the first two stages (querying packet commitments) and the receiving chain indicates which of the first two stages it is in (ack doesn't exist, stage 1. ack does exist, stage 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.
I assume the line of thinking that lead to this function is for it to be used in conjunction with the QueryUnreceivedPackets
. This issue here arises with the introduction of async acknowledgements. Even if you relay unreceived packets, the acknowledgement may not be written for some time. You could keep a cache of those sequences, but you'd still need to query the receiving chain to find out if the acknowledgements have been written (verifying that your unreceived packet sequences has now become unreceived acknowledgements). You see what I am saying?
Regardless, the relayer should not rely on these functions beyond the short term. As per recent decisions in the IBC call, acknowledgements do not have to be written for proper functioning channels. This means packet commitments could live forever and relayers could get stuck trying to determine if an ack needs to be relayed. It should primarily rely on events. Maybe we should add this to the godoc?
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 seems the implemented flow here is trying to take in a list of acknowledgement sequences and check if the packet commitment exists to see the ack needs to be relayed? How does a relayer determine which acknowledgement sequences to send? Unlike packet commitments, acknowledgements live forever so a relayer would have to already know which acknowledgements have not been acknowledged on the original chain, which is the purpose of this function.
Ahh fair point. My thinking was that the relayer gives the entire list of acknowledgements to this function but that may be too large and inefficient in a long lived channel.
The original intention was to send packet commitments that still exist on the sending chain to the receiving chain and see if the ack exists? I can reimplement that, tho I still think it's better to make it a separate RPC call. Unfortunately this doesn't have a symmetry with the QueryUnreceivedPackets
call which makes it non-intuitive.
This issue here arises with the introduction of async acknowledgements. Even if you relay unreceived packets, the acknowledgement may not be written for some time. You could keep a cache of those sequences, but you'd still need to query the receiving chain to find out if the acknowledgements have been written (verifying that your unreceived packet sequences has now become unreceived acknowledgements). You see what I am saying?
Yes its possible even with the original implementation that once async acknowledgements are introduced that packet commitments exist for a long time before the ack gets written. I don't think this is a huge deal and hard to avoid. I think these functions should probably be used on relayer startup and once all pending packets/acks in the queue are cleared, relayer should primarily rely on events
cc: @jackzampolin
Codecov Report
@@ Coverage Diff @@
## master #7320 +/- ##
==========================================
- Coverage 55.41% 55.32% -0.10%
==========================================
Files 583 583
Lines 35550 35637 +87
==========================================
+ Hits 19700 19715 +15
- Misses 13942 14014 +72
Partials 1908 1908 |
I kept the implementation of retrieving
The name change and separation should make things clearer along with the usage docs, and the unsymmetric names should reflect the unsymmetric nature of the calls and make usage more intuitive.
|
Please paste here the output of:
|
|
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, thanks for updating this!
Co-authored-by: colin axnér <[email protected]>
Co-authored-by: colin axnér <[email protected]>
Description
closes: #7319
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