-
Notifications
You must be signed in to change notification settings - Fork 210
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
[Merged by Bors] - Add jitter to spread out requests to get poet proof and submit challenge #4871
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #4871 +/- ##
=========================================
- Coverage 76.9% 76.7% -0.3%
=========================================
Files 261 261
Lines 29807 30241 +434
=========================================
+ Hits 22951 23222 +271
- Misses 5392 5519 +127
- Partials 1464 1500 +36
|
activation/nipost.go
Outdated
// We add a jitter to avoid all nodes querying for the proof at the same time. | ||
func calcGetProofWaitTime(tillRoundEnd, cycleGap time.Duration) (waitTime time.Duration) { | ||
minWaitTime := time.Duration(float64(cycleGap) * MinPoetGetProofJitter / 100.0) | ||
maxWaitTime := time.Duration(float64(cycleGap) * MaxPoetGetProofJitter / 100.0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so thats 0.04% and not 4%? i got confused
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's 0.02% and 0.04%. I can change it if it's confusing.
Jitter is within [0; 1% of grace period].
bors merge |
bors cancel |
Canceled. |
bors merge |
…nge (#4871) ## Motivation Closes #4860 ## Changes Add small positive jitter when: - waiting for a poet round to end (to get proof), - waiting to build a nipost challenge (to spread out challenge registrations). Jitter is only added if the round end is in the future to avoid unnecessary wait. The range of jitter duration is calculated as a percentage of a cycle gap duration so it also works in unit tests and system tests. ### Jitter before getting the proof The min and max % (0.02% and 0.04%) were chosen so that on mainnet: - minimum jitter is roughly equivalent to the time it takes to generate a proof on bare metal poets (it happens after the round ends): 8.64s. This helps avoid situations when many nodes got a 404 response. - maximum jitter is 2xmin - roughly 17s ### Jitter before submitting challenges on mainnet: - min = 0s - max = 36s (1% of grace period) ## Test Plan Added unit tests checking calculating wait and jitter times.
Pull request successfully merged into develop. Build succeeded! The publicly hosted instance of bors-ng is deprecated and will go away soon. If you want to self-host your own instance, instructions are here. If you want to switch to GitHub's built-in merge queue, visit their help page. |
Motivation
Closes #4860
Changes
Add small positive jitter when:
Jitter is only added if the round end is in the future to avoid unnecessary wait.
The range of jitter duration is calculated as a percentage of a cycle gap duration so it also works in unit tests and system tests.
Jitter before getting the proof
The min and max % (0.02% and 0.04%) were chosen so that on mainnet:
Jitter before submitting challenges
on mainnet:
Test Plan
Added unit tests checking calculating wait and jitter times.