Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate --back_sync command-line argument #91

Merged
merged 1 commit into from
Jan 17, 2025
Merged
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
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
Loading