diff --git a/grandine/src/grandine_args.rs b/grandine/src/grandine_args.rs index 9544cd1b..75de2f9b 100644 --- a/grandine/src/grandine_args.rs +++ b/grandine/src/grandine_args.rs @@ -341,9 +341,14 @@ struct BeaconNodeOptions { #[clap(long)] jwt_version: Option, - /// 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 @@ -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, @@ -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 @@ -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"]);