lighthouse/common
Divma e190ebb8a0 Support for Ipv6 (#4046)
## Issue Addressed
Add support for ipv6 and dual stack in lighthouse. 

## Proposed Changes
From an user perspective, now setting an ipv6 address, optionally configuring the ports should feel exactly the same as using an ipv4 address. If listening over both ipv4 and ipv6 then the user needs to:
- use the `--listen-address` two times (ipv4 and ipv6 addresses)
- `--port6` becomes then required
- `--discovery-port6` can now be used to additionally configure the ipv6 udp port

### Rough list of code changes
- Discovery:
  - Table filter and ip mode set to match the listening config. 
  - Ipv6 address, tcp port and udp port set in the ENR builder
  - Reported addresses now check which tcp port to give to libp2p
- LH Network Service:
  - Can listen over Ipv6, Ipv4, or both. This uses two sockets. Using mapped addresses is disabled from libp2p and it's the most compatible option.
- NetworkGlobals:
  - No longer stores udp port since was not used at all. Instead, stores the Ipv4 and Ipv6 TCP ports.
- NetworkConfig:
  - Update names to make it clear that previous udp and tcp ports in ENR were Ipv4
  - Add fields to configure Ipv6 udp and tcp ports in the ENR
  - Include advertised enr Ipv6 address.
  - Add type to model Listening address that's either Ipv4, Ipv6 or both. A listening address includes the ip, udp port and tcp port.
- UPnP:
  - Kept only for ipv4
- Cli flags:
  - `--listen-addresses` now can take up to two values
  - `--port` will apply to ipv4 or ipv6 if only one listening address is given. If two listening addresses are given it will apply only to Ipv4.
  - `--port6` New flag required when listening over ipv4 and ipv6 that applies exclusively to Ipv6.
  - `--discovery-port` will now apply to ipv4 and ipv6 if only one listening address is given.
  - `--discovery-port6` New flag to configure the individual udp port of ipv6 if listening over both ipv4 and ipv6.
  - `--enr-udp-port` Updated docs to specify that it only applies to ipv4. This is an old behaviour.
  - `--enr-udp6-port` Added to configure the enr udp6 field.
  - `--enr-tcp-port` Updated docs to specify that it only applies to ipv4. This is an old behaviour.
  - `--enr-tcp6-port` Added to configure the enr tcp6 field.
  - `--enr-addresses` now can take two values.
  - `--enr-match` updated behaviour.
- Common:
  - rename `unused_port` functions to specify that they are over ipv4.
  - add functions to get unused ports over ipv6.
- Testing binaries
  - Updated code to reflect network config changes and unused_port changes.

## Additional Info

TODOs:
- use two sockets in discovery. I'll get back to this and it's on https://github.com/sigp/discv5/pull/160
- lcli allow listening over two sockets in generate_bootnodes_enr
- add at least one smoke flag for ipv6 (I have tested this and works for me)
- update the book
2023-03-14 01:13:34 +00:00
..
account_utils Clippy lints for rust 1.66 (#3810) 2022-12-16 04:04:00 +00:00
clap_utils Verify execution block hashes during finalized sync (#3794) 2023-01-09 03:11:59 +00:00
compare_fields Clippy 1.67 (#3916) 2023-01-27 09:48:42 +00:00
compare_fields_derive Appease Clippy 1.68 and refactor http_api (#4068) 2023-03-13 01:40:03 +00:00
deposit_contract Update discv5 (#3171) 2022-10-28 05:40:06 +00:00
directory Update to Rust 1.59 and 2021 edition (#3038) 2022-02-25 00:10:17 +00:00
eth2 Optimise payload attributes calculation and add SSE (#4027) 2023-03-05 23:43:30 +00:00
eth2_config Delete Kiln and Ropsten configs (#4038) 2023-03-01 06:16:14 +00:00
eth2_interop_keypairs Update and consolidate dependencies (#3136) 2022-04-04 00:26:16 +00:00
eth2_network_config Set Capella fork epoch for Goerli (#4044) 2023-03-07 03:06:52 +00:00
eth2_wallet_manager Replace OpenOptions::new with File::options to be readable (#3059) 2022-03-07 06:30:18 +00:00
filesystem Fix rust 1.65 lints (#3682) 2022-11-04 07:43:43 +00:00
lighthouse_metrics Support histogram buckets (#3391) 2022-09-13 01:57:44 +00:00
lighthouse_version Release v3.5.1 (#4049) 2023-03-07 07:57:39 +00:00
lockfile Replace OpenOptions::new with File::options to be readable (#3059) 2022-03-07 06:30:18 +00:00
logging Add log debounce to work processor (#3045) 2022-03-07 06:30:17 +00:00
lru_cache Enforce a timeout on peer disconnect (#3757) 2023-02-14 03:25:42 +00:00
malloc_utils Switch allocator to jemalloc (#3697) 2023-01-20 04:19:29 +00:00
monitoring_api Remove fallback support from eth1 service (#3594) 2022-10-04 08:33:39 +00:00
oneshot_broadcast Fix concurrency issue with oneshot_broadcast (#3596) 2022-09-21 10:52:14 +00:00
sensitive_url Fix lints for Rust 1.63 (#3459) 2022-08-12 00:56:39 +00:00
slot_clock Improve testing slot clock to allow manipulation of time in tests (#3974) 2023-02-16 23:34:32 +00:00
system_health Health Endpoints for UI (#3668) 2022-11-15 05:21:26 +00:00
target_check Update to Rust 1.59 and 2021 edition (#3038) 2022-02-25 00:10:17 +00:00
task_executor Enable proposer boost re-orging (#2860) 2022-12-13 09:57:26 +00:00
test_random_derive Update to Rust 1.59 and 2021 edition (#3038) 2022-02-25 00:10:17 +00:00
unused_port Support for Ipv6 (#4046) 2023-03-14 01:13:34 +00:00
validator_dir Clippy lints for rust 1.66 (#3810) 2022-12-16 04:04:00 +00:00
warp_utils Appease Clippy 1.68 and refactor http_api (#4068) 2023-03-13 01:40:03 +00:00
README.md Directory Restructure (#1163) 2020-05-18 21:24:23 +10:00

eth2

Common crates containing eth2-specific logic.