Skip to content
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

Handle duplicate packet events and perform full clearing even in the presence of errors #3361

Merged
merged 8 commits into from
May 23, 2023

Conversation

romac
Copy link
Member

@romac romac commented May 23, 2023

Closes: #3359
Closes: #3358


PR author checklist:

  • Added changelog entry, using unclog.
  • Added tests: integration (for Hermes) or unit/mock tests (for modules).
  • Linked to GitHub issue.
  • Updated code comments and documentation (e.g., docs/).
  • Tagged one reviewer who will be the one responsible for shepherding this PR.

Reviewer checklist:

  • Reviewed Files changed in the GitHub PR explorer.
  • Manually tested (in case integration/unit/mock tests are absent).

@romac romac requested a review from ancazamfir May 23, 2023 11:36
if let Some(event) = packet_from_tx_search_response(chain_id, request, *seq, tx)? {
// We found the event
result.push(event);
break 'inner;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of breaking, could we get them all, if more than 1 extracted print a warning with some tx hashes or height info? And then pick the first? In 99.99% of cases there will be only one so there is no perf impact. But it would give very valuable feedback to the user

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ancazamfir
Copy link
Collaborator

ancazamfir commented May 23, 2023

Looks good. I tried it on the testnet and output looks as good as it can get. I don't have wallets so the actual transactions are not sent so not sure about the fix for recv_packet(#3359) at this point. The acknowedgment packet (#3358) seems to be fixed as I can see the packet being extracted.
@mturkia we should try an image from this branch sometime today.
I am just wondering if there is anything else we need to debug for this before we clear the packets (assuming it will work).

Comment on lines 160 to 161
let (first_event, _, _) = tx_events.remove(0);
result.push(first_event);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we pull these out of the if as we do it for both branches

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@romac romac changed the title Handle duplicate packet events and perform full clearing even if the presence of errors Handle duplicate packet events and perform full clearing even in the presence of errors May 23, 2023
@romac romac marked this pull request as ready for review May 23, 2023 14:18
Copy link
Collaborator

@ancazamfir ancazamfir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Packets are cleared on the testnet! Thanks @romac !!

@romac
Copy link
Member Author

romac commented May 23, 2023

Thank you for diagnosing the issue and coming up with a way to fix it 🙏

@romac romac merged commit 2589793 into master May 23, 2023
@romac romac deleted the romac/dup-send-packet branch May 23, 2023 19:40
pratikbin pushed a commit to pratikbin/hermes that referenced this pull request May 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants