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

Remove chain runtime #3341

Closed
wants to merge 12 commits into from
Closed

Remove chain runtime #3341

wants to merge 12 commits into from

Conversation

romac
Copy link
Member

@romac romac commented May 15, 2023

Closes: #3344

Description

By removing the chain runtime, we can issue queries concurrently rather than serially, which has the potential to speed up relaying in two cases:

a) when relaying on multiple channels between two or more chains
b) when relaying between a chain A and two or more chains B, C, ... with A<->B, A<->C, ...

Note that it won't let us send multiple txs concurrently because of the monotonic constraint on the account sequence number. To speed up this aspect of the relayer, we would need multiple wallets.


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 marked this pull request as ready for review May 17, 2023 06:41

/// A cached copy of the account information
account: Option<Account>,
account: AsyncRwLock<Option<Account>>,
Copy link
Member Author

Choose a reason for hiding this comment

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

Here's the lock for the account

get_or_fetch_account(&self.grpc_addr, &key_account, &mut self.account).await?;
// Take a write lock on the current account,
// excluding anybody from sending txs until we are done.
let mut opt_account = self.account.write().await;
Copy link
Member Author

Choose a reason for hiding this comment

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

We take the lock here for the remaining duration of the function, ie. until the tx has been submitted.


// Take a write lock on the current account,
// excluding anybody from sending txs until we are done.
let mut opt_account = self.account.write().await;
Copy link
Member Author

Choose a reason for hiding this comment

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

We take the lock here for the remaining of the function, ie. until the counterparty payee has been registered.

crates/relayer/src/chain/cosmos.rs Show resolved Hide resolved
romac and others added 4 commits May 22, 2023 11:18
… the chain (#3350)

* Limit the maximum number of requests which can issued concurrently to the chain

Controlled via the `max_concurrency` setting in the chain configuration.

* Swap out `rsevents-extra` for `std-semaphore`
@seanchen1991
Copy link
Contributor

Is this PR just waiting on reviews at this point, or does it need more work?

@romac
Copy link
Member Author

romac commented Jun 8, 2023

Reviews and some testing, ideally in prod ;)

@romac romac requested review from ancazamfir and ljoss17 June 14, 2023 12:00
@romac romac marked this pull request as draft September 27, 2023 12:16
@romac romac closed this Feb 6, 2024
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.

Remove bottleneck on chain runtime for sending queries concurrently
2 participants