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

Simplify channel handshake logic to not involve retry #1090

Merged
merged 6 commits into from
Jul 14, 2021

Conversation

soareschen
Copy link
Contributor

Description

This is a follow up on #1066. I have refactored the logic in do_chan_open_ack_confirm_step so that it completes the full handshake without having to rely on the error retry loop.

The issue of using the same error retry loop for intentional retry is that the delay set in the error retry also affects the intentional retry. For the case of do_chan_open_finalize_with_retry, when do_chan_open_ack_confirm_step returns PartialOpenHandshake, the retry_with_index function will only try the next handshake step after the delay set in the fibonacci delay timer. This can significantly slow down the relayer if we do too many of such retries.

A better strategy is to explicitly write down the expected state transition, especially given that our state machine is pretty small. This also helps improve the readability, as readers do not need to understand the state machine defined else where in order to understand how the code works.


For contributor use:

  • Updated the Unreleased section of CHANGELOG.md with the issue.
  • If applicable: Unit tests written, added test to CI.
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Updated relevant documentation (docs/) and code comments.
  • Re-reviewed Files changed in the Github PR explorer.

@adizere adizere self-assigned this Jun 25, 2021
Copy link
Member

@adizere adizere left a comment

Choose a reason for hiding this comment

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

LGTM!

@adizere adizere merged commit a0c9a78 into master Jul 14, 2021
@adizere adizere deleted the soares/simplify-channel-handshake branch July 14, 2021 09:51
hu55a1n1 pushed a commit to hu55a1n1/hermes that referenced this pull request Sep 13, 2022
…s#1090)

* Simplify channel handshake logic to not involve retry

* More appropriate method names

* Better logging

* Better errors in channel; moved in separate mod

Co-authored-by: Adi Seredinschi <adi@informal.systems>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants