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

Update fetch timeouts as a factor of committee size #3139

Draft
wants to merge 4 commits into
base: mainnet-staging
Choose a base branch
from

Conversation

raychu86
Copy link
Contributor

@raychu86 raychu86 commented Feb 29, 2024

Motivation

This PR updates the MAX_FETCH_TIMEOUT_IN_MS to a dynamic timeout based on the number of validators in the committee set.

The proposed formula for the fetch timeout is BASE_FETCH_TIMEOUT_IN_MS + Xms per validator in the committee set with a maximum of 30 seconds. This X is currently set to 200ms, but can be adjusted based on need.

The BASE_FETCH_TIMEOUT_IN_MS is the original MAX_FETCH_TIMEOUT_IN_MS from before the change, so some example values for timeouts would be:

10 validators => 200 * 10 + 7500 = 9500ms
50 validators => 200 * 50 + 7500 = 17500ms
100 validators => 200 * 100 + 7500 = 27500ms
113+ validators => 30000ms

Related PRs

Based on https://github.com/AleoHQ/snarkOS/pull/3135

Comment on lines +447 to +451
let num_validators = self
.ledger
.get_committee_lookback_for_round(self.storage.current_round())
.map_or(Committee::<N>::MAX_COMMITTEE_SIZE as u64, |committee| committee.num_members() as u64);
let timeout_in_ms = max_fetch_timeout_in_ms(num_validators);
Copy link
Collaborator

Choose a reason for hiding this comment

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

since this is the next time this is calculated, maybe a dedicated method would be a good idea?

Copy link
Collaborator

Choose a reason for hiding this comment

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

(I can also see this done in the worker module)

@raychu86 raychu86 marked this pull request as draft March 2, 2024 20:36
Base automatically changed from adjust-timeouts to mainnet-staging May 2, 2024 00:57
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.

None yet

2 participants