mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
Enable the outbound rate limiter by default, and update blobs method quotas (#6093)
* Enable the outbound rate limiter by default, and update blobs method quotas. * Lint and book updates.
This commit is contained in:
@@ -103,8 +103,13 @@ impl RateLimiterConfig {
|
||||
pub const DEFAULT_GOODBYE_QUOTA: Quota = Quota::one_every(10);
|
||||
pub const DEFAULT_BLOCKS_BY_RANGE_QUOTA: Quota = Quota::n_every(1024, 10);
|
||||
pub const DEFAULT_BLOCKS_BY_ROOT_QUOTA: Quota = Quota::n_every(128, 10);
|
||||
pub const DEFAULT_BLOBS_BY_RANGE_QUOTA: Quota = Quota::n_every(768, 10);
|
||||
pub const DEFAULT_BLOBS_BY_ROOT_QUOTA: Quota = Quota::n_every(128, 10);
|
||||
// `BlocksByRange` and `BlobsByRange` are sent together during range sync.
|
||||
// It makes sense for blocks and blobs quotas to be equivalent in terms of the number of blocks:
|
||||
// 1024 blocks * 6 max blobs per block.
|
||||
// This doesn't necessarily mean that we are sending this many blobs, because the quotas are
|
||||
// measured against the maximum request size.
|
||||
pub const DEFAULT_BLOBS_BY_RANGE_QUOTA: Quota = Quota::n_every(6144, 10);
|
||||
pub const DEFAULT_BLOBS_BY_ROOT_QUOTA: Quota = Quota::n_every(768, 10);
|
||||
pub const DEFAULT_LIGHT_CLIENT_BOOTSTRAP_QUOTA: Quota = Quota::one_every(10);
|
||||
pub const DEFAULT_LIGHT_CLIENT_OPTIMISTIC_UPDATE_QUOTA: Quota = Quota::one_every(10);
|
||||
pub const DEFAULT_LIGHT_CLIENT_FINALITY_UPDATE_QUOTA: Quota = Quota::one_every(10);
|
||||
|
||||
@@ -372,17 +372,22 @@ pub fn cli_app() -> Command {
|
||||
.arg(
|
||||
Arg::new("self-limiter")
|
||||
.long("self-limiter")
|
||||
.help(
|
||||
"Enables the outbound rate limiter (requests made by this node). \
|
||||
Use the self-limiter-protocol flag to set per protocol configurations. \
|
||||
If the self rate limiter is enabled and a protocol is not \
|
||||
present in the configuration, the quotas used for the inbound rate limiter will be \
|
||||
used."
|
||||
)
|
||||
.help("This flag is deprecated and has no effect.")
|
||||
.hide(true)
|
||||
.action(ArgAction::SetTrue)
|
||||
.help_heading(FLAG_HEADER)
|
||||
.display_order(0)
|
||||
)
|
||||
.arg(
|
||||
Arg::new("disable-self-limiter")
|
||||
.long("disable-self-limiter")
|
||||
.help(
|
||||
"Disables the outbound rate limiter (requests sent by this node)."
|
||||
)
|
||||
.action(ArgAction::SetTrue)
|
||||
.help_heading(FLAG_HEADER)
|
||||
.display_order(0)
|
||||
)
|
||||
.arg(
|
||||
Arg::new("self-limiter-protocols")
|
||||
.long("self-limiter-protocols")
|
||||
@@ -397,7 +402,7 @@ pub fn cli_app() -> Command {
|
||||
)
|
||||
.action(ArgAction::Append)
|
||||
.value_delimiter(';')
|
||||
.requires("self-limiter")
|
||||
.conflicts_with("disable-self-limiter")
|
||||
.display_order(0)
|
||||
)
|
||||
.arg(
|
||||
|
||||
@@ -1416,16 +1416,15 @@ pub fn set_network_config(
|
||||
// Light client server config.
|
||||
config.enable_light_client_server = parse_flag(cli_args, "light-client-server");
|
||||
|
||||
// The self limiter is disabled by default. If the `self-limiter` flag is provided
|
||||
// without the `self-limiter-protocols` flag, the default params will be used.
|
||||
if parse_flag(cli_args, "self-limiter") {
|
||||
config.outbound_rate_limiter_config =
|
||||
if let Some(protocols) = cli_args.get_one::<String>("self-limiter-protocols") {
|
||||
Some(protocols.parse()?)
|
||||
} else {
|
||||
Some(Default::default())
|
||||
};
|
||||
}
|
||||
// The self limiter is enabled by default. If the `self-limiter-protocols` flag is not provided,
|
||||
// the default params will be used.
|
||||
config.outbound_rate_limiter_config = if parse_flag(cli_args, "disable-self-limiter") {
|
||||
None
|
||||
} else if let Some(protocols) = cli_args.get_one::<String>("self-limiter-protocols") {
|
||||
Some(protocols.parse()?)
|
||||
} else {
|
||||
Some(Default::default())
|
||||
};
|
||||
|
||||
// Proposer-only mode overrides a number of previous configuration parameters.
|
||||
// Specifically, we avoid subscribing to long-lived subnets and wish to maintain a minimal set
|
||||
|
||||
Reference in New Issue
Block a user