mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-07 00:42:42 +00:00
Set web3signer keep-alive to 20s by default (#5587)
* Set web3signer keep-alive to 20s by default * add tests
This commit is contained in:
@@ -218,7 +218,7 @@ OPTIONS:
|
|||||||
The directory which contains the validator keystores, deposit data for each validator along with the common
|
The directory which contains the validator keystores, deposit data for each validator along with the common
|
||||||
slashing protection database and the validator_definitions.yml
|
slashing protection database and the validator_definitions.yml
|
||||||
--web3-signer-keep-alive-timeout <MILLIS>
|
--web3-signer-keep-alive-timeout <MILLIS>
|
||||||
Keep-alive timeout for each web3signer connection. Set to 'null' to never timeout [default: 90000]
|
Keep-alive timeout for each web3signer connection. Set to 'null' to never timeout [default: 20000]
|
||||||
|
|
||||||
--web3-signer-max-idle-connections <COUNT>
|
--web3-signer-max-idle-connections <COUNT>
|
||||||
Maximum number of idle connections to maintain per web3signer host. Default is unlimited.
|
Maximum number of idle connections to maintain per web3signer host. Default is unlimited.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use validator_client::{ApiTopic, Config};
|
use validator_client::{config::DEFAULT_WEB3SIGNER_KEEP_ALIVE, ApiTopic, Config};
|
||||||
|
|
||||||
use crate::exec::CommandLineTestExec;
|
use crate::exec::CommandLineTestExec;
|
||||||
use bls::{Keypair, PublicKeyBytes};
|
use bls::{Keypair, PublicKeyBytes};
|
||||||
@@ -9,6 +9,7 @@ use std::path::PathBuf;
|
|||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use std::string::ToString;
|
use std::string::ToString;
|
||||||
|
use std::time::Duration;
|
||||||
use tempfile::TempDir;
|
use tempfile::TempDir;
|
||||||
use types::Address;
|
use types::Address;
|
||||||
|
|
||||||
@@ -653,3 +654,26 @@ fn validator_disable_web3_signer_slashing_protection() {
|
|||||||
assert!(!config.enable_web3signer_slashing_protection);
|
assert!(!config.enable_web3signer_slashing_protection);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn validator_web3_signer_keep_alive_default() {
|
||||||
|
CommandLineTest::new().run().with_config(|config| {
|
||||||
|
assert_eq!(
|
||||||
|
config.web3_signer_keep_alive_timeout,
|
||||||
|
DEFAULT_WEB3SIGNER_KEEP_ALIVE
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn validator_web3_signer_keep_alive_override() {
|
||||||
|
CommandLineTest::new()
|
||||||
|
.flag("web3-signer-keep-alive-timeout", Some("1000"))
|
||||||
|
.run()
|
||||||
|
.with_config(|config| {
|
||||||
|
assert_eq!(
|
||||||
|
config.web3_signer_keep_alive_timeout,
|
||||||
|
Some(Duration::from_secs(1))
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
@@ -391,7 +391,7 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
|
|||||||
Arg::with_name("web3-signer-keep-alive-timeout")
|
Arg::with_name("web3-signer-keep-alive-timeout")
|
||||||
.long("web3-signer-keep-alive-timeout")
|
.long("web3-signer-keep-alive-timeout")
|
||||||
.value_name("MILLIS")
|
.value_name("MILLIS")
|
||||||
.default_value("90000")
|
.default_value("20000")
|
||||||
.help("Keep-alive timeout for each web3signer connection. Set to 'null' to never \
|
.help("Keep-alive timeout for each web3signer connection. Set to 'null' to never \
|
||||||
timeout")
|
timeout")
|
||||||
.takes_value(true),
|
.takes_value(true),
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ use std::time::Duration;
|
|||||||
use types::{Address, GRAFFITI_BYTES_LEN};
|
use types::{Address, GRAFFITI_BYTES_LEN};
|
||||||
|
|
||||||
pub const DEFAULT_BEACON_NODE: &str = "http://localhost:5052/";
|
pub const DEFAULT_BEACON_NODE: &str = "http://localhost:5052/";
|
||||||
|
pub const DEFAULT_WEB3SIGNER_KEEP_ALIVE: Option<Duration> = Some(Duration::from_secs(20));
|
||||||
|
|
||||||
/// Stores the core configuration for this validator instance.
|
/// Stores the core configuration for this validator instance.
|
||||||
#[derive(Clone, Serialize, Deserialize)]
|
#[derive(Clone, Serialize, Deserialize)]
|
||||||
@@ -133,7 +134,7 @@ impl Default for Config {
|
|||||||
builder_boost_factor: None,
|
builder_boost_factor: None,
|
||||||
prefer_builder_proposals: false,
|
prefer_builder_proposals: false,
|
||||||
distributed: false,
|
distributed: false,
|
||||||
web3_signer_keep_alive_timeout: Some(Duration::from_secs(90)),
|
web3_signer_keep_alive_timeout: DEFAULT_WEB3SIGNER_KEEP_ALIVE,
|
||||||
web3_signer_max_idle_connections: None,
|
web3_signer_max_idle_connections: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ mod beacon_node_fallback;
|
|||||||
mod block_service;
|
mod block_service;
|
||||||
mod check_synced;
|
mod check_synced;
|
||||||
mod cli;
|
mod cli;
|
||||||
mod config;
|
|
||||||
mod duties_service;
|
mod duties_service;
|
||||||
mod graffiti_file;
|
mod graffiti_file;
|
||||||
mod http_metrics;
|
mod http_metrics;
|
||||||
@@ -14,6 +13,7 @@ mod preparation_service;
|
|||||||
mod signing_method;
|
mod signing_method;
|
||||||
mod sync_committee_service;
|
mod sync_committee_service;
|
||||||
|
|
||||||
|
pub mod config;
|
||||||
mod doppelganger_service;
|
mod doppelganger_service;
|
||||||
pub mod http_api;
|
pub mod http_api;
|
||||||
pub mod initialized_validators;
|
pub mod initialized_validators;
|
||||||
|
|||||||
Reference in New Issue
Block a user