-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add jitter to spread out requests to get poet proof and submit challe…
…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.
- Loading branch information
Showing
4 changed files
with
118 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters