mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 10:11:44 +00:00
Add an option to disable inbound rate limiter (#4327)
## Issue Addressed On deneb devnetv5, lighthouse keeps rate limiting peers which makes it harder to bootstrap new nodes as there are very few peers in the network. This PR adds an option to disable the inbound rate limiter for testnets. Added an option to configure inbound rate limits as well. Co-authored-by: Diva M <divma@protonmail.com>
This commit is contained in:
@@ -282,7 +282,23 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
|
||||
for a beacon node being referenced by validator client using the --proposer-node flag. This configuration is for enabling more secure setups.")
|
||||
.takes_value(false),
|
||||
)
|
||||
|
||||
.arg(
|
||||
Arg::with_name("inbound-rate-limiter")
|
||||
.long("inbound-rate-limiter")
|
||||
.help(
|
||||
"Configures the inbound rate limiter (requests received by this node).\
|
||||
\
|
||||
Rate limit quotas per protocol can be set in the form of \
|
||||
<protocol_name>:<tokens>/<time_in_seconds>. 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. \
|
||||
\
|
||||
This is enabled by default, using default quotas. To disable rate limiting pass \
|
||||
`disabled` to this option instead."
|
||||
)
|
||||
.takes_value(true)
|
||||
.hidden(true)
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("disable-backfill-rate-limiting")
|
||||
.long("disable-backfill-rate-limiting")
|
||||
|
||||
@@ -1232,6 +1232,7 @@ pub fn set_network_config(
|
||||
// Light client server config.
|
||||
config.enable_light_client_server = cli_args.is_present("light-client-server");
|
||||
|
||||
// The self limiter is disabled by default.
|
||||
// This flag can be used both with or without a value. Try to parse it first with a value, if
|
||||
// no value is defined but the flag is present, use the default params.
|
||||
config.outbound_rate_limiter_config = clap_utils::parse_optional(cli_args, "self-limiter")?;
|
||||
@@ -1252,7 +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 `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(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user