Skip to content

Conversation

ltitanb
Copy link
Collaborator

@ltitanb ltitanb commented Jul 29, 2024

fix #23

This PR adds support for timing games, ie. allows a node operator to fine tune how to send get_header requests to relays. This is configured via two new per-relay parameters:

  • target_first_request_ms: which sets how late in the slot to send the first header request
  • frequency_get_header_ms: which sets how frequently to send header requests after the first

and a global param:

  • late_in_slot_time_ms: which sets how late in the slot is "late", acting as a hard upper bound for when to return headers to the CL

The requests are still bound by timeout_get_header_ms which is ~what the full get_header request can take at most from the CL perspective (plus some small overhead from the module itself).

The logic is as follows:

  • if the request from the CL comes before target_first_request_ms, wait until the target time
  • after that send requests every frequency_get_header_ms with decreasing timeouts
  • if the request comes later into the slot, then reduce the max timeout accordingly

Examples
Assuming: timeout_get_header_ms = 950, frequency_get_header_ms = 300, target_first_request_ms = 200, late_in_slot_time_ms = 2000

  1. CL request comes at 100ms in the slot (max timeout 1050ms in the slot), then:
  • sleep for 100ms
  • send request at 200ms with 850ms timeout
  • send request at 500ms with 550ms timeout
  • send request at 800ms with 250ms timeout
  1. CL request comes at 1500ms in the slot (max timeout 2000ms in the slot), then:
  • send request at 1500ms with 500ms timeout
  • send request at 1800ms with 200ms timeout
  1. CL request comes 2500ms in the slot then:
  • return 204 and force local build

@fbrv fbrv mentioned this pull request Jul 30, 2024
5 tasks
@ltitanb ltitanb changed the title Ltitanb/timing games timing games Jul 30, 2024
@ltitanb ltitanb force-pushed the ltitanb/timing-games branch from 390740c to 695c421 Compare July 30, 2024 16:39
@fbrv fbrv mentioned this pull request Jul 31, 2024
5 tasks
@ltitanb ltitanb force-pushed the ltitanb/timing-games branch from 695c421 to f82b852 Compare July 31, 2024 09:56
@ltitanb ltitanb merged commit 02f2a08 into main Jul 31, 2024
@ltitanb ltitanb deleted the ltitanb/timing-games branch July 31, 2024 11:50
@cwhcheng
Copy link

cwhcheng commented Mar 6, 2025

Hi! If a relay intentionally delays the return of the get_header response to the max timeout value, does it make any difference whether the validators try to send multiple get_header request within the timeout?

@ltitanb
Copy link
Collaborator Author

ltitanb commented Mar 6, 2025

hey @cwhcheng would depend on a number of factors such as how long the relay is waiting and how they process this internally, best way is probably to make real world tests

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.

Add support for timing games
3 participants