Skip to content
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

UX Network Fixes #6796

Open
wants to merge 10 commits into
base: unstable
Choose a base branch
from
3 changes: 1 addition & 2 deletions beacon_node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,7 @@ pub fn cli_app() -> Command {
.long("port6")
.value_name("PORT")
.help("The TCP/UDP ports to listen on over IPv6 when listening over both IPv4 and \
IPv6. Defaults to 9090 when required. The Quic UDP port will be set to this value + 1.")
.default_value("9090")
IPv6. Defaults to --port. The Quic UDP port will be set to this value + 1.")
.action(ArgAction::Set)
.display_order(0)
)
Expand Down
22 changes: 18 additions & 4 deletions beacon_node/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -932,12 +932,11 @@ pub fn parse_listening_addresses(
.expect("--port has a default value")
.parse::<u16>()
.map_err(|parse_error| format!("Failed to parse --port as an integer: {parse_error}"))?;
let port6 = cli_args
let maybe_port6 = cli_args
.get_one::<String>("port6")
.map(|s| str::parse::<u16>(s))
.transpose()
.map_err(|parse_error| format!("Failed to parse --port6 as an integer: {parse_error}"))?
.unwrap_or(9090);
.map_err(|parse_error| format!("Failed to parse --port6 as an integer: {parse_error}"))?;

// parse the possible discovery ports.
let maybe_disc_port = cli_args
Expand Down Expand Up @@ -985,6 +984,14 @@ pub fn parse_listening_addresses(
warn!(log, "When listening only over IPv6, use the --port flag. The value of --port6 will be ignored.");
}

// If we are only listening on ipv6 and the user has specified --port6, lets just use
// that.
let port = if let Some(port6) = maybe_port6 {
port6
} else {
port
};
Comment on lines +989 to +993
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change
let port = if let Some(port6) = maybe_port6 {
port6
} else {
port
};
let port = maybe_port6.unwrap_or(port);


// use zero ports if required. If not, use the given port.
let tcp_port = use_zero_ports
.then(unused_port::unused_tcp6_port)
Expand Down Expand Up @@ -1051,6 +1058,13 @@ pub fn parse_listening_addresses(
})
}
(Some(ipv4), Some(ipv6)) => {
// If --port6 is not set, we use --port
let port6 = if let Some(port6) = maybe_port6 {
port6
} else {
port
};
Comment on lines +1062 to +1066
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change
let port6 = if let Some(port6) = maybe_port6 {
port6
} else {
port
};
let port6 = maybe_port6.unwrap_or(port);


let ipv4_tcp_port = use_zero_ports
.then(unused_port::unused_tcp4_port)
.transpose()?
Expand All @@ -1070,7 +1084,7 @@ pub fn parse_listening_addresses(
ipv4_tcp_port + 1
});

// Defaults to 9090 when required
// Defaults to 9000 when required
let ipv6_tcp_port = use_zero_ports
.then(unused_port::unused_tcp6_port)
.transpose()?
Expand Down
8 changes: 4 additions & 4 deletions book/src/advanced_networking.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ To listen over both IPv4 and IPv6:
>
> **IPv6**:
>
> It listens on the default value of --port6 (`9090`) for both UDP and TCP.
> QUIC will use port `9091` for UDP, which is the default `--port6` value (`9090`) + 1.
> It listens on the default value of --port6 (`9000`) for both UDP and TCP.
> QUIC will use port `9001` for UDP, which is the default `--port6` value (`9000`) + 1.

> When using `--listen-address :: --listen-address --port 9909 --discovery-port6 9999`, listening will be set up as follows:
>
Expand All @@ -174,8 +174,8 @@ To listen over both IPv4 and IPv6:
>
> **IPv6**:
>
> It listens on the default value of `--port6` (`9090`) for TCP, and port `9999` for UDP.
> QUIC will use port `9091` for UDP, which is the default `--port6` value (`9090`) + 1.
> It listens on the default value of `--port6` (`9000`) for TCP, and port `9999` for UDP.
> QUIC will use port `9001` for UDP, which is the default `--port6` value (`9000`) + 1.

### Configuring Lighthouse to advertise IPv6 reachable addresses

Expand Down
4 changes: 2 additions & 2 deletions book/src/help_bn.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ Options:
[default: 9000]
--port6 <PORT>
The TCP/UDP ports to listen on over IPv6 when listening over both IPv4
and IPv6. Defaults to 9090 when required. The Quic UDP port will be
set to this value + 1. [default: 9090]
and IPv6. Defaults to --port. The Quic UDP port will be set to this
value + 1.
--prepare-payload-lookahead <MILLISECONDS>
The time before the start of a proposal slot at which payload
attributes should be sent. Low values are useful for execution nodes
Expand Down
Loading