Skip to content

Conversation

@raychu86
Copy link
Collaborator

@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 #3135

@raychu86 raychu86 requested review from kpandl, ljedrz and vvp February 29, 2024 23:37
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.

3 participants