diff --git a/Cargo.lock b/Cargo.lock index 36f13ff6fc..8dafb24e20 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6639,6 +6639,7 @@ dependencies = [ "jsonrpc-derive", "jsonrpc-ipc-server", "jsonrpc-server-utils", + "lazy_static", "libc", "log", "num_cpus", diff --git a/programs/bpf/Cargo.lock b/programs/bpf/Cargo.lock index e818163950..576bfb8689 100644 --- a/programs/bpf/Cargo.lock +++ b/programs/bpf/Cargo.lock @@ -5853,6 +5853,7 @@ dependencies = [ "jsonrpc-derive", "jsonrpc-ipc-server", "jsonrpc-server-utils", + "lazy_static", "libc", "log", "num_cpus", diff --git a/validator/Cargo.toml b/validator/Cargo.toml index 07ce035db4..ad5bdaf383 100644 --- a/validator/Cargo.toml +++ b/validator/Cargo.toml @@ -23,6 +23,7 @@ jsonrpc-core-client = { version = "18.0.0", features = ["ipc"] } jsonrpc-derive = "18.0.0" jsonrpc-ipc-server = "18.0.0" jsonrpc-server-utils = "18.0.0" +lazy_static = "1.4.0" log = "0.4.17" num_cpus = "1.13.1" rand = "0.7.0" diff --git a/validator/src/main.rs b/validator/src/main.rs index 878046f85c..60febdfb92 100644 --- a/validator/src/main.rs +++ b/validator/src/main.rs @@ -7,6 +7,7 @@ use { AppSettings, Arg, ArgMatches, SubCommand, }, console::style, + lazy_static::lazy_static, log::*, rand::{seq::SliceRandom, thread_rng}, solana_clap_utils::{ @@ -594,15 +595,6 @@ pub fn main() { .takes_value(false) .help("Launch validator without voting"), ) - .arg( - Arg::with_name("no_check_vote_account") - .long("no-check-vote-account") - .takes_value(false) - .conflicts_with("no_voting") - .requires("entrypoint") - .hidden(true) - .help("Skip the RPC vote account sanity check") - ) .arg( Arg::with_name("check_vote_account") .long("check-vote-account") @@ -639,13 +631,6 @@ pub fn main() { .validator(solana_validator::port_validator) .help("Enable JSON RPC on this port, and the next port for the RPC websocket"), ) - .arg( - Arg::with_name("minimal_rpc_api") - .long("--minimal-rpc-api") - .takes_value(false) - .hidden(true) - .help("Only expose the RPC methods required to serve snapshots to other nodes"), - ) .arg( Arg::with_name("full_rpc_api") .long("--full-rpc-api") @@ -694,16 +679,6 @@ pub fn main() { .takes_value(false) .help("Upload new confirmed blocks into a BigTable instance"), ) - .arg( - Arg::with_name("enable_cpi_and_log_storage") - .long("enable-cpi-and-log-storage") - .requires("enable_rpc_transaction_history") - .takes_value(false) - .hidden(true) - .help("Deprecated, please use \"enable-extended-tx-metadata-storage\". \ - Include CPI inner instructions, logs and return data in \ - the historical transaction info stored"), - ) .arg( Arg::with_name("enable_extended_tx_metadata_storage") .long("enable-extended-tx-metadata-storage") @@ -886,18 +861,6 @@ pub fn main() { slots behind the highest snapshot available for \ download from other validators"), ) - .arg( - Arg::with_name("incremental_snapshots") - .long("incremental-snapshots") - .takes_value(false) - .hidden(true) - .conflicts_with("no_incremental_snapshots") - .help("Enable incremental snapshots") - .long_help("Enable incremental snapshots by setting this flag. \ - When enabled, --snapshot-interval-slots will set the \ - incremental snapshot interval. To set the full snapshot \ - interval, use --full-snapshot-interval-slots.") - ) .arg( Arg::with_name("no_incremental_snapshots") .long("no-incremental-snapshots") @@ -1227,12 +1190,6 @@ pub fn main() { will not push/pull from from validators outside this set. \ [default: all validators]") ) - .arg( - Arg::with_name("no_rocksdb_compaction") - .long("no-rocksdb-compaction") - .takes_value(false) - .help("Disable manual compaction of the ledger database (this is ignored).") - ) .arg( Arg::with_name("rocksdb_compaction_interval") .long("rocksdb-compaction-interval-slots") @@ -1268,17 +1225,6 @@ pub fn main() { .takes_value(false) .help("Enable UDP for receiving/sending transactions."), ) - .arg( - Arg::with_name("disable_quic_servers") - .long("disable-quic-servers") - .takes_value(false) - .hidden(true) - ) - .arg( - Arg::with_name("enable_quic_servers") - .hidden(true) - .long("enable-quic-servers") - ) .arg( Arg::with_name("tpu_connection_pool_size") .long("tpu-connection-pool-size") @@ -1632,14 +1578,6 @@ pub fn main() { .takes_value(false) .help("Disable the just-in-time compiler and instead use the interpreter for BPF"), ) - .arg( - // legacy nop argument - Arg::with_name("bpf_jit") - .long("bpf-jit") - .hidden(true) - .takes_value(false) - .conflicts_with("no_bpf_jit") - ) .arg( Arg::with_name("poh_pinned_cpu_core") .hidden(true) @@ -1805,28 +1743,6 @@ pub fn main() { .help("Enables testing of hash calculation using stores in \ AccountsHashVerifier. This has a computational cost."), ) - .arg( - Arg::with_name("accounts_db_index_hashing") - .long("accounts-db-index-hashing") - .help("Enables the use of the index in hash calculation in \ - AccountsHashVerifier/Accounts Background Service.") - .hidden(true), - ) - .arg( - Arg::with_name("no_accounts_db_index_hashing") - .long("no-accounts-db-index-hashing") - .help("This is obsolete. See --accounts-db-index-hashing. \ - Disables the use of the index in hash calculation in \ - AccountsHashVerifier/Accounts Background Service.") - .hidden(true), - ) - .arg( - // legacy nop argument - Arg::with_name("accounts_db_caching_enabled") - .long("accounts-db-caching-enabled") - .conflicts_with("no_accounts_db_caching") - .hidden(true) - ) .arg( Arg::with_name("accounts_shrink_optimize_total_space") .long("accounts-shrink-optimize-total-space") @@ -1877,6 +1793,7 @@ pub fn main() { .long("replay-slots-concurrently") .help("Allow concurrent replay of slots on different forks") ) + .args(&get_deprecated_arguments()) .after_help("The default subcommand is run") .subcommand( SubCommand::with_name("exit") @@ -2055,6 +1972,7 @@ pub fn main() { then this not a good time for a restart") ) .get_matches(); + warn_for_deprecated_arguments(&matches); let socket_addr_space = SocketAddrSpace::new(matches.is_present("allow_private_addr")); let ledger_path = PathBuf::from(matches.value_of("ledger_path").unwrap()); @@ -2375,9 +2293,6 @@ pub fn main() { let init_complete_file = matches.value_of("init_complete_file"); - if matches.is_present("no_check_vote_account") { - info!("vote account sanity checks are no longer performed by default. --no-check-vote-account is deprecated and can be removed from the command line"); - } let rpc_bootstrap_config = bootstrap::RpcBootstrapConfig { no_genesis_fetch: matches.is_present("no_genesis_fetch"), no_snapshot_fetch: matches.is_present("no_snapshot_fetch"), @@ -2621,25 +2536,6 @@ pub fn main() { None }; - if matches.is_present("minimal_rpc_api") { - warn!("--minimal-rpc-api is now the default behavior. This flag is deprecated and can be removed from the launch args"); - } - - if matches.is_present("enable_cpi_and_log_storage") { - warn!( - "--enable-cpi-and-log-storage is deprecated. Please update the \ - launch args to use --enable-extended-tx-metadata-storage and remove \ - --enable-cpi-and-log-storage" - ); - } - - if matches.is_present("enable_quic_servers") { - warn!("--enable-quic-servers is now the default behavior. This flag is deprecated and can be removed from the launch args"); - } - if matches.is_present("disable_quic_servers") { - warn!("--disable-quic-servers is deprecated. The quic server cannot be disabled."); - } - let rpc_bigtable_config = if matches.is_present("enable_rpc_bigtable_ledger_storage") || matches.is_present("enable_bigtable_ledger_upload") { @@ -2659,12 +2555,6 @@ pub fn main() { None }; - if matches.is_present("accounts_db_index_hashing") { - info!("The accounts hash is only calculated without using the index. --accounts-db-index-hashing is deprecated and can be removed from the command line"); - } - if matches.is_present("no_accounts_db_index_hashing") { - info!("The accounts hash is only calculated without using the index. --no-accounts-db-index-hashing is deprecated and can be removed from the command line"); - } let rpc_send_retry_rate_ms = value_t_or_exit!(matches, "rpc_send_transaction_retry_ms", u64); let rpc_send_batch_size = value_t_or_exit!(matches, "rpc_send_transaction_batch_size", usize); let rpc_send_batch_send_rate_ms = @@ -3012,9 +2902,6 @@ pub fn main() { exit(1); } - if matches.is_present("incremental_snapshots") { - warn!("--incremental-snapshots is now the default behavior. This flag is deprecated and can be removed from the launch args") - } if matches.is_present("limit_ledger_size") { let limit_ledger_size = match matches.value_of("limit_ledger_size") { @@ -3334,3 +3221,125 @@ fn process_account_indexes(matches: &ArgMatches) -> AccountSecondaryIndexes { indexes: account_indexes, } } + +// Helper to add arguments that are no longer used but are being kept around to +// avoid breaking validator startup commands +fn get_deprecated_arguments() -> Vec> { + vec![ + Arg::with_name("accounts_db_caching_enabled") + .long("accounts-db-caching-enabled") + .conflicts_with("no_accounts_db_caching") + .hidden(true), + Arg::with_name("accounts_db_index_hashing") + .long("accounts-db-index-hashing") + .help( + "Enables the use of the index in hash calculation in \ + AccountsHashVerifier/Accounts Background Service.", + ) + .hidden(true), + Arg::with_name("no_accounts_db_index_hashing") + .long("no-accounts-db-index-hashing") + .help( + "This is obsolete. See --accounts-db-index-hashing. \ + Disables the use of the index in hash calculation in \ + AccountsHashVerifier/Accounts Background Service.", + ) + .hidden(true), + Arg::with_name("bpf_jit") + .long("bpf-jit") + .hidden(true) + .takes_value(false) + .conflicts_with("no_bpf_jit"), + Arg::with_name("disable_quic_servers") + .long("disable-quic-servers") + .takes_value(false) + .hidden(true), + Arg::with_name("enable_quic_servers") + .hidden(true) + .long("enable-quic-servers"), + Arg::with_name("enable_cpi_and_log_storage") + .long("enable-cpi-and-log-storage") + .requires("enable_rpc_transaction_history") + .takes_value(false) + .hidden(true) + .help( + "Deprecated, please use \"enable-extended-tx-metadata-storage\". \ + Include CPI inner instructions, logs and return data in \ + the historical transaction info stored", + ), + Arg::with_name("incremental_snapshots") + .long("incremental-snapshots") + .takes_value(false) + .hidden(true) + .conflicts_with("no_incremental_snapshots") + .help("Enable incremental snapshots") + .long_help( + "Enable incremental snapshots by setting this flag. \ + When enabled, --snapshot-interval-slots will set the \ + incremental snapshot interval. To set the full snapshot \ + interval, use --full-snapshot-interval-slots.", + ), + Arg::with_name("minimal_rpc_api") + .long("--minimal-rpc-api") + .takes_value(false) + .hidden(true) + .help("Only expose the RPC methods required to serve snapshots to other nodes"), + Arg::with_name("no_check_vote_account") + .long("no-check-vote-account") + .takes_value(false) + .conflicts_with("no_voting") + .requires("entrypoint") + .hidden(true) + .help("Skip the RPC vote account sanity check"), + Arg::with_name("no_rocksdb_compaction") + .long("no-rocksdb-compaction") + .hidden(true) + .takes_value(false) + .help("Disable manual compaction of the ledger database (this is ignored)."), + ] +} + +lazy_static! { + static ref DEPRECATED_ARGS_AND_HELP: Vec<(&'static str, &'static str)> = vec![ + ("accounts_db_caching_enabled", ""), + ( + "accounts_db_index_hashing", + "The accounts hash is only calculated without using the index.", + ), + ( + "no_accounts_db_index_hashing", + "The accounts hash is only calculated without using the index.", + ), + ("bpf_jit", ""), + ( + "disable_quic_servers", + "The quic server cannot be disabled.", + ), + ( + "enable_quic_servers", + "The quic server is now enabled by default.", + ), + ( + "enable_cpi_and_log_storage", + "Please use --enable-extended-tx-metadata-storage instead.", + ), + ("incremental_snapshots", ""), + ("minimal_rpc_api", ""), + ( + "no_check_vote_account", + "Vote account sanity checks are no longer performed by default.", + ), + ("no_rocksdb_compaction", ""), + ]; +} + +fn warn_for_deprecated_arguments(matches: &ArgMatches) { + for (arg, help) in DEPRECATED_ARGS_AND_HELP.iter() { + if matches.is_present(arg) { + warn!( + "{}", + format!("--{} is deprecated. {}", arg, help).replace('_', "-") + ); + } + } +}