Skip to content
Open
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
2 changes: 2 additions & 0 deletions Cargo.lock

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

4 changes: 3 additions & 1 deletion crates/apollo_network_benchmark/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ license-file.workspace = true
testing = []

[dependencies]
clap = { workspace = true, features = ["derive"] }
clap = { workspace = true, features = ["derive", "env"] }
lazy_static.workspace = true
tokio = { workspace = true, features = ["full", "sync"] }
tracing.workspace = true
tracing-subscriber.workspace = true


[dev-dependencies]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Runs a node that stress tests the p2p communication of the network.

use clap::Parser;
use tracing::Level;

#[cfg(test)]
mod message_test;
Expand All @@ -11,6 +12,22 @@ use apollo_network_benchmark::node_args::NodeArgs;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let _args = NodeArgs::parse();
let args = NodeArgs::parse();

let level = match args.user.verbosity {
0 => None,
1 => Some(Level::ERROR),
2 => Some(Level::WARN),
3 => Some(Level::INFO),
4 => Some(Level::DEBUG),
_ => Some(Level::TRACE),
};
tracing::subscriber::set_global_default(
tracing_subscriber::FmtSubscriber::builder().with_max_level(level).finish(),
)
.expect("Failed to set global default subscriber");

println!("Starting network stress test with args:\n{args:?}");

Ok(())
}
21 changes: 20 additions & 1 deletion crates/apollo_network_benchmark/src/node_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,23 @@ use clap::Parser;

#[derive(Parser, Debug, Clone)]
#[command(version, about, long_about = None)]
pub struct NodeArgs {}
/// Arguments from the runner, not meant to be set by the user.
pub struct RunnerArgs {}

#[derive(Parser, Debug, Clone)]
#[command(version, about, long_about = None)]
/// Arguments from the user.
pub struct UserArgs {
/// Set the verbosity level of the logger, the higher the more verbose
#[arg(short, long, env, default_value = "2")]
pub verbosity: u8,
}

#[derive(Parser, Debug, Clone)]
#[command(version, about, long_about = None)]
pub struct NodeArgs {
#[command(flatten)]
pub runner: RunnerArgs,
#[command(flatten)]
pub user: UserArgs,
}
Loading