Add --block-{verification,production}-method flags (noop atm) (#30746)

* Add --{replaying,banking}-backend flags (noop atm)

* Greatly simplify enums with strum

* Update programs/sbf/Cargo.lock...

* Rely on Display, removing Debug

* constify cli_names()

* Don't allow omitting bankend value

* Rename to --block-{verification,production}-method

* Use more specific name

* Actually support missing value....

* Remove strictly-unnecessary flags

* Use lazy_static! instead of abusing DefaultArgs...
This commit is contained in:
Ryo Onodera 2023-03-23 12:57:28 +09:00 committed by GitHub
parent 04f0311aa1
commit 6c444df9e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 129 additions and 3 deletions

2
Cargo.lock generated
View File

@ -5387,6 +5387,8 @@ dependencies = [
"solana-version",
"solana-vote-program",
"static_assertions",
"strum",
"strum_macros",
"sys-info",
"sysctl",
"systemstat",

View File

@ -63,6 +63,8 @@ solana-tpu-client = { workspace = true }
solana-transaction-status = { workspace = true }
solana-version = { workspace = true }
solana-vote-program = { workspace = true }
strum = { workspace = true, features = ["derive"] }
strum_macros = { workspace = true }
sys-info = { workspace = true }
tempfile = { workspace = true }
thiserror = { workspace = true }

View File

@ -28,6 +28,7 @@ use {
tvu::{Tvu, TvuConfig, TvuSockets},
},
crossbeam_channel::{bounded, unbounded, Receiver},
lazy_static::lazy_static,
rand::{thread_rng, Rng},
solana_client::connection_cache::ConnectionCache,
solana_entry::poh::compute_hash_time_ns,
@ -116,11 +117,61 @@ use {
thread::{sleep, Builder, JoinHandle},
time::{Duration, Instant},
},
strum::VariantNames,
strum_macros::{Display, EnumString, EnumVariantNames, IntoStaticStr},
};
const MAX_COMPLETED_DATA_SETS_IN_CHANNEL: usize = 100_000;
const WAIT_FOR_SUPERMAJORITY_THRESHOLD_PERCENT: u64 = 80;
#[derive(Clone, EnumString, EnumVariantNames, Default, IntoStaticStr, Display)]
#[strum(serialize_all = "kebab-case")]
pub enum BlockVerificationMethod {
#[default]
BlockstoreProcessor,
}
impl BlockVerificationMethod {
pub const fn cli_names() -> &'static [&'static str] {
Self::VARIANTS
}
pub fn cli_message() -> &'static str {
lazy_static! {
static ref MESSAGE: String = format!(
"Switch transaction scheduling method for verifying ledger entries [default: {}]",
BlockVerificationMethod::default()
);
};
&MESSAGE
}
}
#[derive(Clone, EnumString, EnumVariantNames, Default, IntoStaticStr, Display)]
#[strum(serialize_all = "kebab-case")]
pub enum BlockProductionMethod {
#[default]
ThreadLocalMultiIterator,
}
impl BlockProductionMethod {
pub const fn cli_names() -> &'static [&'static str] {
Self::VARIANTS
}
pub fn cli_message() -> &'static str {
lazy_static! {
static ref MESSAGE: String = format!(
"Switch transaction scheduling method for producing ledger entries [default: {}]",
BlockProductionMethod::default()
);
};
&MESSAGE
}
}
pub struct ValidatorConfig {
pub halt_at_slot: Option<Slot>,
pub expected_genesis_hash: Option<Hash>,
@ -184,6 +235,8 @@ pub struct ValidatorConfig {
pub runtime_config: RuntimeConfig,
pub replay_slots_concurrently: bool,
pub banking_trace_dir_byte_limit: banking_trace::DirByteLimit,
pub block_verification_method: BlockVerificationMethod,
pub block_production_method: BlockProductionMethod,
}
impl Default for ValidatorConfig {
@ -248,6 +301,8 @@ impl Default for ValidatorConfig {
runtime_config: RuntimeConfig::default(),
replay_slots_concurrently: false,
banking_trace_dir_byte_limit: 0,
block_verification_method: BlockVerificationMethod::default(),
block_production_method: BlockProductionMethod::default(),
}
}
}
@ -687,6 +742,10 @@ impl Validator {
config.accounts_db_test_hash_calculation,
last_full_snapshot_slot,
);
info!(
"Using: block-verification-method: {}, block-production-method: {}",
config.block_verification_method, config.block_production_method
);
let leader_schedule_cache = Arc::new(leader_schedule_cache);
let mut process_blockstore = ProcessBlockStore::new(

View File

@ -25,7 +25,10 @@ use {
},
},
solana_cli_output::{CliAccount, CliAccountNewConfig, OutputFormat},
solana_core::system_monitor_service::{SystemMonitorService, SystemMonitorStatsReportConfig},
solana_core::{
system_monitor_service::{SystemMonitorService, SystemMonitorStatsReportConfig},
validator::BlockVerificationMethod,
},
solana_entry::entry::Entry,
solana_geyser_plugin_manager::geyser_plugin_service::GeyserPluginService,
solana_ledger::{
@ -1244,6 +1247,16 @@ fn load_bank_forks(
accounts_update_notifier,
&Arc::default(),
);
let block_verification_method = value_t!(
arg_matches,
"block_verification_method",
BlockVerificationMethod
)
.unwrap_or_default();
info!(
"Using: block-verification-method: {}",
block_verification_method,
);
let (snapshot_request_sender, snapshot_request_receiver) = crossbeam_channel::unbounded();
let (accounts_package_sender, _accounts_package_receiver) = crossbeam_channel::unbounded();
@ -1695,6 +1708,16 @@ fn main() {
.global(true)
.help("Use DIR for separate incremental snapshot location"),
)
.arg(
Arg::with_name("block_verification_method")
.long("block-verification-method")
.value_name("METHOD")
.takes_value(true)
.possible_values(BlockVerificationMethod::cli_names())
.global(true)
.hidden(hidden_unless_forced())
.help(BlockVerificationMethod::cli_message()),
)
.arg(
Arg::with_name("output_format")
.long("output")

View File

@ -66,6 +66,8 @@ pub fn safe_clone_config(config: &ValidatorConfig) -> ValidatorConfig {
runtime_config: config.runtime_config.clone(),
replay_slots_concurrently: config.replay_slots_concurrently,
banking_trace_dir_byte_limit: config.banking_trace_dir_byte_limit,
block_verification_method: config.block_verification_method.clone(),
block_production_method: config.block_production_method.clone(),
}
}

View File

@ -4657,6 +4657,8 @@ dependencies = [
"solana-transaction-status",
"solana-version",
"solana-vote-program",
"strum",
"strum_macros",
"sys-info",
"sysctl",
"tempfile",

View File

@ -11,7 +11,10 @@ use {
},
keypair::SKIP_SEED_PHRASE_VALIDATION_ARG,
},
solana_core::banking_trace::{DirByteLimit, BANKING_TRACE_DIR_DEFAULT_BYTE_LIMIT},
solana_core::{
banking_trace::{DirByteLimit, BANKING_TRACE_DIR_DEFAULT_BYTE_LIMIT},
validator::{BlockProductionMethod, BlockVerificationMethod},
},
solana_faucet::faucet::{self, FAUCET_PORT},
solana_net_utils::{MINIMUM_VALIDATOR_PORT_RANGE_WIDTH, VALIDATOR_PORT_RANGE},
solana_rpc::{rpc::MAX_REQUEST_BODY_SIZE, rpc_pubsub_service::PubSubConfig},
@ -1340,6 +1343,24 @@ pub fn app<'a>(version: &'a str, default_args: &'a DefaultArgs) -> App<'a, 'a> {
up to the default or specified total bytes in the \
ledger")
)
.arg(
Arg::with_name("block_verification_method")
.long("block-verification-method")
.hidden(hidden_unless_forced())
.value_name("METHOD")
.takes_value(true)
.possible_values(BlockVerificationMethod::cli_names())
.help(BlockVerificationMethod::cli_message())
)
.arg(
Arg::with_name("block_production_method")
.long("block-production-method")
.hidden(hidden_unless_forced())
.value_name("METHOD")
.takes_value(true)
.possible_values(BlockProductionMethod::cli_names())
.help(BlockProductionMethod::cli_message())
)
.args(&get_deprecated_arguments())
.after_help("The default subcommand is run")
.subcommand(

View File

@ -14,7 +14,10 @@ use {
system_monitor_service::SystemMonitorService,
tower_storage,
tpu::DEFAULT_TPU_COALESCE_MS,
validator::{is_snapshot_config_valid, Validator, ValidatorConfig, ValidatorStartProgress},
validator::{
is_snapshot_config_valid, BlockProductionMethod, BlockVerificationMethod, Validator,
ValidatorConfig, ValidatorStartProgress,
},
},
solana_gossip::{cluster_info::Node, legacy_contact_info::LegacyContactInfo as ContactInfo},
solana_ledger::blockstore_options::{
@ -1526,6 +1529,18 @@ pub fn main() {
}
configure_banking_trace_dir_byte_limit(&mut validator_config, &matches);
validator_config.block_verification_method = value_t!(
matches,
"block_verification_method",
BlockVerificationMethod
)
.unwrap_or_default();
validator_config.block_production_method = value_t!(
matches, // comment to align formatting...
"block_production_method",
BlockProductionMethod
)
.unwrap_or_default();
validator_config.ledger_column_options = LedgerColumnOptions {
compression_type: match matches.value_of("rocksdb_ledger_compression") {