Skip to content

Commit

Permalink
Deprecate --back_sync command-line argument
Browse files Browse the repository at this point in the history
  • Loading branch information
Tumas committed Jan 17, 2025
1 parent ef49396 commit d1a8a91
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions grandine/src/grandine_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,14 @@ struct BeaconNodeOptions {
#[clap(long)]
jwt_version: Option<String>,

/// Enable syncing historical data
/// [DEPRECATED] Enable syncing historical data
/// [default: disabled]
#[clap(long = "back_sync")]
back_sync: bool,

/// Enable syncing historical data
/// [default: disabled]
#[clap(long = "back-sync")]
back_sync_enabled: bool,

/// Collect Prometheus metrics
Expand Down Expand Up @@ -908,7 +913,8 @@ impl GrandineArgs {
jwt_id,
jwt_secret,
jwt_version,
back_sync_enabled,
back_sync,
mut back_sync_enabled,
metrics_enabled,
metrics_address,
metrics_port,
Expand Down Expand Up @@ -1200,6 +1206,11 @@ impl GrandineArgs {
version: jwt_version,
};

if back_sync {
warn!("--back_sync option is deprecated. Use --back-sync instead.");
back_sync_enabled = true;
}

let builder_url = if builder_url.is_none() && builder_api_url.is_some() {
warn!("--builder-api-url option is deprecated. Use --builder-url instead.");
builder_api_url
Expand Down Expand Up @@ -1503,6 +1514,24 @@ mod tests {
);
}

#[test]
fn back_sync_disabled_by_default() {
let config = config_from_args([]);
assert!(!config.back_sync_enabled);
}

#[test]
fn supports_back_sync_flag() {
let config = config_from_args(["--back-sync"]);
assert!(config.back_sync_enabled);
}

#[test]
fn supports_deprecated_back_sync_flag() {
let config = config_from_args(["--back_sync"]);
assert!(config.back_sync_enabled);
}

#[test]
fn eth1_rpc_urls_single_value() {
let config = config_from_args(["--eth1-rpc-urls", "http://localhost:8545"]);
Expand Down

0 comments on commit d1a8a91

Please sign in to comment.