-
Notifications
You must be signed in to change notification settings - Fork 358
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
Duplicate packets on start #2256
Duplicate packets on start #2256
Conversation
Pulling in upstream changes
Merge in upstream changes
Can we add a test here? Seems like the kind of bug that can resurface easily after a refactor |
Looked a bit through the logs and what happens is that depending on the event registration, hermes may miss the The fix is to clear packets at |
You may want to wait for @soareschen's PR https://github.com/informalsystems/ibc-rs/pull/2238 as the changes there will affect this PR and you can make use the refactoring there. |
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.
The changes look good, thanks @seanchen1991! some commented out code needs to be cleaned. I will approve as I am off tomorrow.
* Pull in upstream changes * Remove unnecessary destructuring assignment * Decrement height when scheduling packet clearing * Add changelog entry * Clarify comment * Remove unnecessary destructure * Initiate clear packet flow when a IbcEvent is received * Revert to more straightforward logic to see if CI still breaks * Refactor handle_packet_cmd * Clean up handle_packet_cmd * Update handle_packet_cmd doc comment * Incorporate PR feedback
Closes: #2093
Description
This PR changes the
handle_packet_cmd
flow so that it initiates the clearing of packets upon receiving a batch ofIbcEvents
.The issue seems to have originated as a result of some non-determinism in how the relayer subscribes to chains. The usual expected flow is that upon subscribing to a chain, a
NewBlock
command is received at some heighth
, followed by anIbcEvents
command also at heighth
. However, sometimes theNewBlock
command at heighth
would be missed and the relayer would only receive theIbcEvents
command at heighth
. This command would be processed at heighth
, and then later a subsequentNewBlock
command at associated with heighth + 1
would arrive, which would trigger aclear_pending_packets
flow at heighth
, which resulted in a "packet messages are redundant" error since the relayer would attempt to clear theIbcEvents
at heighth
, but they had already been cleared.The key insight was realizing that the relayer needs to clear pending packets regardless of whether the
NewBlock
command arrives before theIbcEvents
command or vice versa. Regardless of the ordering of these two commands, pending packets at heighth - 1
and before need to be cleared once on startup if the relayer has been configured to do so.PR author checklist:
unclog
.docs/
).Reviewer checklist:
Files changed
in the GitHub PR explorer.