Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 3 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ futures-timer = "3.0"
backon = "1.6.0"
hex = { version = "0.4.3" }
hex-literal = "0.4"
humantime = "2.1"
prost = "0.14"
prost-build = "0.14"
prost-types = "0.14"
Expand Down Expand Up @@ -116,7 +115,7 @@ flate2 = "1.1"
wiremock = "0.6"
tower = "0.5"
sysinfo = "0.33"
quick-xml = { version = "0.39", features = ["serialize"] }
quick-xml = { version = "0.41", features = ["serialize"] }

# Crates in the workspace
pluto-app = { path = "crates/app" }
Expand Down
1 change: 0 additions & 1 deletion crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ clap.workspace = true
thiserror.workspace = true
k256.workspace = true
hex.workspace = true
humantime.workspace = true
tokio.workspace = true
pluto-app.workspace = true
pluto-eth1wrap.workspace = true
Expand Down
38 changes: 19 additions & 19 deletions crates/cli/src/commands/relay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,23 +128,23 @@ pub struct RelayDataDirArgs {
pub struct RelayRelayArgs {
#[arg(
long = "http-address",
env = "PLUTO_HTTP_ADDRESS",
env = "CHARON_HTTP_ADDRESS",
default_value = "127.0.0.1:3640",
help = "Listening address (ip and port) for the relay http server serving runtime ENR."
)]
pub http_address: String,

#[arg(
long = "auto-p2pkey",
env = "PLUTO_AUTO_P2PKEY",
env = "CHARON_AUTO_P2PKEY",
default_value_t = true,
help = "Automatically generate and persist a p2p key if one does not exist."
)]
pub auto_p2p_key: bool,

#[arg(
long = "p2p-relay-loglevel",
env = "PLUTO_P2P_RELAY_LOGLEVEL",
env = "CHARON_P2P_RELAY_LOGLEVEL",
default_value = "",
help = "Libp2p circuit relay log level. E.g., debug, info, warn, error."
)]
Expand All @@ -154,23 +154,23 @@ pub struct RelayRelayArgs {
// If so, decrease defaults after this has been addressed
#[arg(
long = "p2p-max-reservations",
env = "PLUTO_P2P_MAX_RESERVATIONS",
env = "CHARON_P2P_MAX_RESERVATIONS",
default_value_t = 512,
help = "Updates max circuit reservations per peer (each valid for 30min)"
)]
pub max_res_per_peer: usize,

#[arg(
long = "p2p-max-connections",
env = "PLUTO_P2P_MAX_CONNECTIONS",
env = "CHARON_P2P_MAX_CONNECTIONS",
default_value_t = 16384,
help = "Libp2p maximum number of peers that can connect to this relay."
)]
pub max_conns: usize,

#[arg(
long = "p2p-advertise-private-addresses",
env = "PLUTO_P2P_ADVERTISE_PRIVATE_ADDRESSES",
env = "CHARON_P2P_ADVERTISE_PRIVATE_ADDRESSES",
help = "Enable advertising of libp2p auto-detected private addresses. This doesn't affect manually provided p2p-external-ip/hostname."
)]
pub advertise_priv: bool,
Expand All @@ -180,14 +180,14 @@ pub struct RelayRelayArgs {
pub struct RelayDebugMonitoringArgs {
#[arg(
long = "monitoring-address",
env = "PLUTO_MONITORING_ADDRESS",
env = "CHARON_MONITORING_ADDRESS",
help = "Listening address (ip and port) for the monitoring API (prometheus)."
)]
pub monitor_addr: Option<String>,

#[arg(
long = "debug-address",
env = "PLUTO_DEBUG_ADDRESS",
env = "CHARON_DEBUG_ADDRESS",
default_value = "",
help = "Listening address (ip and port) for the pprof and QBFT debug API. It is not enabled by default."
)]
Expand All @@ -198,7 +198,7 @@ pub struct RelayDebugMonitoringArgs {
pub struct RelayP2PArgs {
#[arg(
long = "p2p-relays",
env = "PLUTO_P2P_RELAYS",
env = "CHARON_P2P_RELAYS",
value_delimiter = ',',
default_values_t = pluto_p2p::config::DEFAULT_RELAYS.map(String::from),
help = "Comma-separated list of libp2p relay URLs or multiaddrs."
Expand All @@ -207,37 +207,37 @@ pub struct RelayP2PArgs {

#[arg(
long = "p2p-external-ip",
env = "PLUTO_P2P_EXTERNAL_IP",
env = "CHARON_P2P_EXTERNAL_IP",
help = "The IP address advertised by libp2p. This may be used to advertise an external IP."
)]
pub external_ip: Option<String>,

#[arg(
long = "p2p-external-hostname",
env = "PLUTO_P2P_EXTERNAL_HOSTNAME",
env = "CHARON_P2P_EXTERNAL_HOSTNAME",
help = "The DNS hostname advertised by libp2p. This may be used to advertise an external DNS."
)]
pub external_host: Option<String>,

#[arg(
long = "p2p-tcp-address",
env = "PLUTO_P2P_TCP_ADDRESS",
env = "CHARON_P2P_TCP_ADDRESS",
value_delimiter = ',',
help = "Comma-separated list of listening TCP addresses (ip and port) for libP2P traffic. Empty default doesn't bind to local port therefore only supports outgoing connections."
)]
pub tcp_addrs: Vec<String>,

#[arg(
long = "p2p-udp-address",
env = "PLUTO_P2P_UDP_ADDRESS",
env = "CHARON_P2P_UDP_ADDRESS",
value_delimiter = ',',
help = "Comma-separated list of listening UDP addresses (ip and port) for libP2P traffic. Empty default doesn't bind to local port therefore only supports outgoing connections."
)]
pub udp_addrs: Vec<String>,

#[arg(
long = "p2p-disable-reuseport",
env = "PLUTO_P2P_DISABLE_REUSEPORT",
env = "CHARON_P2P_DISABLE_REUSEPORT",
default_value_t = false,
help = "Disables TCP port reuse for outgoing libp2p connections."
)]
Expand All @@ -248,15 +248,15 @@ pub struct RelayP2PArgs {
pub struct RelayLogFlags {
#[arg(
long = "log-format",
env = "PLUTO_LOG_FORMAT",
env = "CHARON_LOG_FORMAT",
default_value = "console",
help = "Log format; console, logfmt or json"
)]
pub format: String,

#[arg(
long = "log-level",
env = "PLUTO_LOG_LEVEL",
env = "CHARON_LOG_LEVEL",
default_value = "info",
help = "Log level; debug, info, warn or error"
)]
Expand All @@ -267,7 +267,7 @@ pub struct RelayLogFlags {

#[arg(
long = "log-output-path",
env = "PLUTO_LOG_OUTPUT_PATH",
env = "CHARON_LOG_OUTPUT_PATH",
help = "Path in which to write on-disk logs."
)]
pub log_output_path: Option<PathBuf>,
Expand All @@ -277,15 +277,15 @@ pub struct RelayLogFlags {
pub struct RelayLokiArgs {
#[arg(
long = "loki-addresses",
env = "PLUTO_LOKI_ADDRESSES",
env = "CHARON_LOKI_ADDRESSES",
value_delimiter = ',',
help = "Enables sending of logfmt structured logs to these Loki log aggregation server addresses. This is in addition to normal stderr logs."
)]
pub loki_addresses: Vec<String>,

#[arg(
long = "loki-service",
env = "PLUTO_LOKI_SERVICE",
env = "CHARON_LOKI_SERVICE",
default_value = "pluto",
help = "Service label sent with logs to Loki."
)]
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/commands/test/beacon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub struct TestBeaconArgs {
#[arg(
long = "load-test-duration",
default_value = "5s",
value_parser = humantime::parse_duration,
value_parser = crate::duration::parse_go_duration,
help = "Time to keep running the load tests. For each second a new continuous ping instance is spawned."
)]
pub load_test_duration: StdDuration,
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/commands/test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub struct TestConfigArgs {
#[arg(
long,
default_value = "1h",
value_parser = humantime::parse_duration,
value_parser = crate::duration::parse_go_duration,
help = "Execution timeout for all tests"
)]
pub timeout: StdDuration,
Expand Down
6 changes: 3 additions & 3 deletions crates/cli/src/commands/test/peers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ pub struct TestPeersArgs {
#[arg(
long = "keep-alive",
default_value = "30m",
value_parser = humantime::parse_duration
value_parser = crate::duration::parse_go_duration
)]
pub keep_alive: Duration,

Expand All @@ -130,15 +130,15 @@ pub struct TestPeersArgs {
#[arg(
long = "load-test-duration",
default_value = "30s",
value_parser = humantime::parse_duration
value_parser = crate::duration::parse_go_duration
)]
pub load_test_duration: Duration,

/// Time to keep trying to establish direct connection to peer.
#[arg(
long = "direct-connection-timeout",
default_value = "2m",
value_parser = humantime::parse_duration
value_parser = crate::duration::parse_go_duration
)]
pub direct_connection_timeout: Duration,

Expand Down
45 changes: 44 additions & 1 deletion crates/cli/src/commands/test/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use tokio_util::sync::CancellationToken;

use super::{
AllCategoriesResult, TestCategory, TestCategoryResult, TestConfigArgs, TestResult, TestVerdict,
must_output_to_file_on_quiet,
};
use crate::{
duration::Duration as CliDuration,
Expand Down Expand Up @@ -75,7 +76,7 @@ pub struct TestValidatorArgs {
#[arg(
long = "load-test-duration",
default_value = "5s",
value_parser = humantime::parse_duration,
value_parser = crate::duration::parse_go_duration,
help = "Time to keep running the load tests. For each second a new continuous ping instance is spawned."
)]
pub load_test_duration: Duration,
Expand All @@ -87,6 +88,8 @@ pub async fn run(
writer: &mut dyn Write,
ct: CancellationToken,
) -> Result<TestCategoryResult> {
must_output_to_file_on_quiet(args.test_config.quiet, &args.test_config.output_json)?;

tracing::info!("Starting validator client test");

// Get and filter test cases
Expand Down Expand Up @@ -315,3 +318,43 @@ async fn ping_continuously(
tokio::time::sleep(Duration::from_millis(sleep_ms)).await;
}
}

#[cfg(test)]
mod tests {
use super::*;
use std::time::Duration as StdDuration;

fn default_test_config() -> TestConfigArgs {
TestConfigArgs {
output_json: String::new(),
quiet: false,
test_cases: None,
timeout: StdDuration::from_secs(60),
publish: false,
publish_addr: String::new(),
publish_private_key_file: std::path::PathBuf::new(),
}
}

fn default_validator_args() -> TestValidatorArgs {
TestValidatorArgs {
test_config: default_test_config(),
api_address: "127.0.0.1:3600".to_string(),
load_test_duration: StdDuration::from_secs(1),
}
}

#[tokio::test]
async fn run_quiet_without_output_json_returns_error() {
let mut args = default_validator_args();
args.test_config.quiet = true;
let mut output = Vec::new();
let err = run(args, &mut output, CancellationToken::new())
.await
.unwrap_err();
assert!(
err.to_string()
.contains("on --quiet, an --output-json is required")
);
}
}
Loading
Loading