diff --git a/beacon_node/src/cli.rs b/beacon_node/src/cli.rs index cd88fdac715..59e8cf4ac52 100644 --- a/beacon_node/src/cli.rs +++ b/beacon_node/src/cli.rs @@ -259,15 +259,6 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> { .help("Lighthouse by default does not discover private IP addresses. Set this flag to enable connection attempts to local addresses.") .takes_value(false), ) - .arg( - Arg::with_name("disable-inbound-rate-limiter") - .long("disable-inbound-rate-limiter") - .help("Disables the inbound rate limiting (received by this node) over rpc. \ - Note: using this option could overwhelm the node with unbounded number \ - of rpc requests. Use with caution.") - .hidden(true) - .takes_value(false), - ) .arg( Arg::with_name("self-limiter") .long("self-limiter") @@ -295,14 +286,16 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> { Arg::with_name("inbound-rate-limiter") .long("inbound-rate-limiter") .help( - "Enables the inbound rate limiter (requests received by this node).\ + "Configures the inbound rate limiter (requests received by this node).\ \ Rate limit quotas per protocol can be set in the form of \ :/. To set quotas for multiple protocols, \ separate them by ';'. If the inbound rate limiter is enabled and a protocol is not \ - present in the configuration, the default quotas will be used." + present in the configuration, the default quotas will be used. \ + \ + This is enabled by default, using default quotas. To disable rate limiting pass \ + `disabled` to this option instead." ) - .min_values(0) .hidden(true) ) .arg( diff --git a/beacon_node/src/config.rs b/beacon_node/src/config.rs index f67bdfb15f5..7bfe96f67bd 100644 --- a/beacon_node/src/config.rs +++ b/beacon_node/src/config.rs @@ -1253,18 +1253,22 @@ pub fn set_network_config( config.proposer_only = true; warn!(log, "Proposer-only mode enabled"; "info"=> "Do not connect a validator client to this node unless via the --proposer-nodes flag"); } - // The inbound rate limiter is enabled by default unless the `disable-inbound-rate-limiter` flag is specified. - // Hence, we first try to parse it with a value, if no value is defined, we set it to the default parameters. - // If `disable-inbound-rate-limiter` is specified, we disable inbound rate limiting explicitly. - config.inbound_rate_limiter_config = - clap_utils::parse_optional(cli_args, "inbound-rate-limiter")?; - if config.inbound_rate_limiter_config.is_none() { - config.inbound_rate_limiter_config = Some(Default::default()); - } - if cli_args.is_present("disable-inbound-rate-limiter") { - config.inbound_rate_limiter_config = None; - } - + // The inbound rate limiter is enabled by default unless `disabled` is passed to the + // `inbound-rate-limiter` flag. Any other value should be parsed as a configuration string. + config.inbound_rate_limiter_config = match cli_args.value_of("inbound-rate-limiter") { + None => { + // Enabled by default, with default values + Some(Default::default()) + } + Some("disabled") => { + // Explicitly disabled + None + } + Some(config_str) => { + // Enabled with a custom configuration + Some(config_str.parse()?) + } + }; Ok(()) } @@ -1340,4 +1344,4 @@ where .into_iter() .next() .ok_or(format!("Must provide at least one value to {}", flag_name)) -} +} \ No newline at end of file