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

Hermes: Conditionally spawn the relayer worker only if there are outstanding packets #901

Closed
3 of 8 tasks
adizere opened this issue May 5, 2021 · 0 comments · Fixed by #1197
Closed
3 of 8 tasks
Assignees
Labels
A: good-first-issue Admin: good for newcomers I: CLI Internal: related to the relayer's CLI I: logic Internal: related to the relaying logic O: new-feature Objective: cause to add a new feature or support O: performance Objective: cause to improve performance
Milestone

Comments

@adizere
Copy link
Member

adizere commented May 5, 2021

Crate

relayer

Summary

We should optimize the starting of a worker for a UnidirectionalChannelPath, so that the worker only get spawned if there is any outstanding packets to relay (e.g., unreceived packets or unreceived acks).

Problem Definition

Currently, within the multi-start command, the workers for UnidirectionalChannelPath get spawned as soon as Hermes detects an open channel. This worker, however, might not have any job to do if there are no outstanding packets to relay.

https://github.com/informalsystems/ibc-rs/blob/13f592b8a4db47356a057470949c41361391564a/relayer/src/supervisor.rs#L231-L238

Proposal

Prior to spawning the worker for UnidirectionalChannelPath, we should detect if there are unreceived packets (or acks). To detect this, we can reuse functionality from query CLIs UnreceivedPackets (and UnreceivedAcks), see . The query CLI implementation, however, spawns its own runtimes and consequently it is awkward to reuse it.

Acceptance Criteria

We should probably proceed as follows:

  • refactor the logic in CLIs for UnreceivedPackets and UnreceivedAcks. Ideally, we should encapsulate the logic for detecting outstanding packets in some methods, and reuse those methods both from the CLI queries and from multi-start command.
  • adapt the behavior for the multi-start command, in the supervisor to conditionally spawn a worker for UnidirectionalChannelPath only if there are outstanding packets to relay.
  • the same modifications should occur for the start command

For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate milestone (priority) applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@adizere adizere added O: new-feature Objective: cause to add a new feature or support A: good-first-issue Admin: good for newcomers I: CLI Internal: related to the relayer's CLI I: logic Internal: related to the relaying logic O: performance Objective: cause to improve performance labels May 5, 2021
@adizere adizere added this to the 05.2021 milestone May 5, 2021
@ancazamfir ancazamfir self-assigned this May 18, 2021
@ancazamfir ancazamfir modified the milestones: 05.2021, 06.2021 May 25, 2021
@ancazamfir ancazamfir modified the milestones: 06.2021, 07.2021 Jun 7, 2021
@ancazamfir ancazamfir assigned hu55a1n1 and unassigned ancazamfir and hu55a1n1 Jul 12, 2021
@adizere adizere modified the milestones: 07.2021, 08.2021 Aug 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A: good-first-issue Admin: good for newcomers I: CLI Internal: related to the relayer's CLI I: logic Internal: related to the relaying logic O: new-feature Objective: cause to add a new feature or support O: performance Objective: cause to improve performance
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants