Skip to content

Instantly share code, notes, and snippets.

@jmcph4
Created August 29, 2023 07:05
Show Gist options
  • Select an option

  • Save jmcph4/1abb99d72bedb035b4e361cd7eb269b9 to your computer and use it in GitHub Desktop.

Select an option

Save jmcph4/1abb99d72bedb035b4e361cd7eb269b9 to your computer and use it in GitHub Desktop.

Description

Due to the ordering of various operations during initialisation of Lighthouse's networking stack, we are currently unable to defer port selection to the OS (i.e., bind to the 0 port). The ability to do so is desirable for a few reasons; namely that it would avoid racing on bound port numbers which are currently causing some instability in our tests and subsequently CI jobs.

Currently, the following procedure describes the initialisation of the network service:

  1. Parse relevant CLI flags
  2. Produce a network service configuration from these flags
  3. Initialise the UPnP service

https://github.com/sigp/lighthouse/blob/0c23c86849401ea38456e8b1b9a9b0ea4b826ea7/beacon_node/network/src/service.rs#L241-L257

  1. Start lighthouse_network (i.e., our libp2p handle)

https://github.com/sigp/lighthouse/blob/0c23c86849401ea38456e8b1b9a9b0ea4b826ea7/beacon_node/network/src/service.rs#L292-L294

a) Build ENR

https://github.com/sigp/lighthouse/blob/0c23c86849401ea38456e8b1b9a9b0ea4b826ea7/beacon_node/network/src/service.rs#L296-L306

b) Setup network globals using this ENR

Steps to resolve

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment