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

Fetch transmissions and certificates simultaneously #3420

Open
wants to merge 1 commit into
base: staging
Choose a base branch
from

Conversation

vicsn
Copy link
Contributor

@vicsn vicsn commented Oct 23, 2024

Motivation

Fetching transmissions poses a significant bottleneck in consensus. This simple change can avoid waiting for a synchronous roundtrip of certificate fetching, which happens almost every round.

Test Plan

Tested on a local devnet with traffic.

@vicsn vicsn changed the title Fetch transmissions asynchronously Fetch transmissions and certificates simultaneously Oct 23, 2024
@vicsn vicsn marked this pull request as ready for review October 23, 2024 12:39
// Ensure the primary has all of the transmissions.
let missing_transmissions = self.fetch_missing_transmissions(peer_ip, batch_header).await.map_err(|e| {
// Collect any missing transmissions.
let missing_transmissions = transmissions_promise.await.map_err(|e| {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it make sense to await at the very end of the function, since we only return the result of the promise?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also had that thought! But sync_with_certificate_from_peer below recursively calls back into this function, which could then cause duplicate transmissions to be fetched. Under certain assumptions, that might actually be faster, but it seems cleaner to await fetching transmissions before syncing with new certificates.

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