Skip to content

Commit ff3d9f7

Browse files
committed
Merge branch 'main' into HEAD
2 parents 262bb7a + 23098c4 commit ff3d9f7

7 files changed

Lines changed: 36 additions & 46 deletions

File tree

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,11 @@ targets.json
1616
.idea/
1717
logs
1818
.vscode/
19+
20+
# Nix
21+
.direnv/
22+
.devenv/
23+
devenv.*
24+
devenv.lock
25+
.devenv.flake.nix
26+
.envrc

bin/cli.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,8 @@
11
use clap::Parser;
22

3-
/// Version string with a leading 'v'
4-
const VERSION: &str = concat!("v", env!("CARGO_PKG_VERSION"));
5-
6-
/// Subcommands and global arguments for the module
7-
#[derive(Parser, Debug)]
8-
#[command(name = "Commit-Boost CLI", version = VERSION, about, long_about = None)]
9-
struct Cli {}
10-
11-
/// Main entry point of the Commit-Boost CLI
123
#[tokio::main]
134
async fn main() -> eyre::Result<()> {
14-
// Parse the CLI arguments (currently only used for version info, more can be
15-
// added later)
16-
let _cli = Cli::parse();
17-
185
color_eyre::install()?;
19-
// set default backtrace unless provided
206

217
let args = cb_cli::Args::parse();
228

bin/pbs.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,14 @@ use clap::Parser;
77
use eyre::Result;
88
use tracing::{error, info};
99

10-
/// Version string with a leading 'v'
11-
const VERSION: &str = concat!("v", env!("CARGO_PKG_VERSION"));
12-
13-
/// Subcommands and global arguments for the module
14-
#[derive(Parser, Debug)]
15-
#[command(name = "Commit-Boost PBS Service", version = VERSION, about, long_about = None)]
16-
struct Cli {}
17-
1810
#[tokio::main]
1911
async fn main() -> Result<()> {
20-
// Parse the CLI arguments (currently only used for version info, more can be
21-
// added later)
22-
let _cli = Cli::parse();
12+
let _args = cb_cli::PbsArgs::parse();
2313

2414
color_eyre::install()?;
2515

2616
let _guard = initialize_tracing_log(PBS_MODULE_NAME, LogsSettings::from_env_config()?);
2717

28-
let _args = cb_cli::PbsArgs::parse();
29-
3018
let (pbs_config, config_path) = load_pbs_config(None).await?;
3119

3220
PbsService::init_metrics(pbs_config.chain)?;

bin/signer.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,14 @@ use clap::Parser;
77
use eyre::Result;
88
use tracing::{error, info};
99

10-
/// Version string with a leading 'v'
11-
const VERSION: &str = concat!("v", env!("CARGO_PKG_VERSION"));
12-
13-
/// Subcommands and global arguments for the module
14-
#[derive(Parser, Debug)]
15-
#[command(name = "Commit-Boost Signer Service", version = VERSION, about, long_about = None)]
16-
struct Cli {}
17-
1810
#[tokio::main]
1911
async fn main() -> Result<()> {
20-
// Parse the CLI arguments (currently only used for version info, more can be
21-
// added later)
22-
let _cli = Cli::parse();
12+
let _args = cb_cli::SignerArgs::parse();
2313

2414
color_eyre::install()?;
2515

2616
let _guard = initialize_tracing_log(SIGNER_MODULE_NAME, LogsSettings::from_env_config()?);
2717

28-
let _args = cb_cli::SignerArgs::parse();
29-
3018
let config = StartSignerConfig::load_from_env()?;
3119
let server = SigningService::run(config);
3220

crates/cli/src/lib.rs

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ use clap::{Parser, Subcommand};
55

66
mod docker_init;
77

8+
/// Version string with a leading 'v'
9+
const VERSION: &str = concat!("v", env!("CARGO_PKG_VERSION"));
10+
811
#[derive(Parser, Debug)]
9-
#[command(version, about, long_about = LONG_ABOUT, name = "commit-boost-cli")]
12+
#[command(version = VERSION, about, long_about = LONG_ABOUT, name = "commit-boost-cli")]
1013
pub struct Args {
1114
#[command(subcommand)]
1215
pub cmd: Command,
@@ -41,9 +44,25 @@ impl Args {
4144
const LONG_ABOUT: &str = "Commit-Boost allows Ethereum validators to safely run MEV-Boost and community-built commitment protocols";
4245

4346
#[derive(Parser, Debug)]
44-
#[command(version, about, long_about = LONG_ABOUT, name = "commit-boost-pbs")]
47+
#[command(version = VERSION, about, long_about = LONG_ABOUT, name = "commit-boost-pbs")]
4548
pub struct PbsArgs;
4649

4750
#[derive(Parser, Debug)]
48-
#[command(version, about, long_about = LONG_ABOUT, name = "commit-boost-signer")]
51+
#[command(version = VERSION, about, long_about = LONG_ABOUT, name = "commit-boost-signer")]
4952
pub struct SignerArgs;
53+
54+
#[cfg(test)]
55+
mod tests {
56+
use super::*;
57+
58+
#[test]
59+
fn version_has_v_prefix() {
60+
assert!(VERSION.starts_with('v'), "VERSION should start with 'v', got: {VERSION}");
61+
}
62+
63+
#[test]
64+
fn parse_init_subcommand() {
65+
Args::try_parse_from(["commit-boost-cli", "init", "--config", "/tmp/config.toml"])
66+
.expect("should parse init subcommand");
67+
}
68+
}

tests/tests/pbs_cfg_file_update.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ async fn test_cfg_file_update() -> Result<()> {
5959
* or anything close to it */
6060
extra_validation_enabled: false,
6161
rpc_url: None,
62-
ssv_api_url: Url::parse("http://example.com").unwrap(),
62+
ssv_node_api_url: Url::parse("http://example.com").unwrap(),
63+
ssv_public_api_url: Url::parse("http://example.com").unwrap(),
6364
http_timeout_seconds: 10,
6465
register_validator_retry_limit: 3,
6566
validator_registration_batch_size: None,

tests/tests/pbs_mux.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ async fn test_ssv_multi_with_node() -> Result<()> {
345345
config.registry_muxes = Some(registry_muxes);
346346

347347
// Run PBS service
348-
let state = PbsState::new(config);
348+
let state = PbsState::new(config, PathBuf::new());
349349
let pbs_server = tokio::spawn(PbsService::run::<(), DefaultBuilderApi>(state));
350350
info!("Started PBS server with pubkey {pubkey}");
351351

@@ -441,7 +441,7 @@ async fn test_ssv_multi_with_public() -> Result<()> {
441441
config.registry_muxes = Some(registry_muxes);
442442

443443
// Run PBS service
444-
let state = PbsState::new(config);
444+
let state = PbsState::new(config, PathBuf::new());
445445
let pbs_server = tokio::spawn(PbsService::run::<(), DefaultBuilderApi>(state));
446446
info!("Started PBS server with pubkey {pubkey}");
447447

0 commit comments

Comments
 (0)