Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit 6c444df

Browse files
authored
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...
1 parent 04f0311 commit 6c444df

File tree

8 files changed

+129
-3
lines changed

8 files changed

+129
-3
lines changed

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ solana-tpu-client = { workspace = true }
6363
solana-transaction-status = { workspace = true }
6464
solana-version = { workspace = true }
6565
solana-vote-program = { workspace = true }
66+
strum = { workspace = true, features = ["derive"] }
67+
strum_macros = { workspace = true }
6668
sys-info = { workspace = true }
6769
tempfile = { workspace = true }
6870
thiserror = { workspace = true }

core/src/validator.rs

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ use {
2828
tvu::{Tvu, TvuConfig, TvuSockets},
2929
},
3030
crossbeam_channel::{bounded, unbounded, Receiver},
31+
lazy_static::lazy_static,
3132
rand::{thread_rng, Rng},
3233
solana_client::connection_cache::ConnectionCache,
3334
solana_entry::poh::compute_hash_time_ns,
@@ -116,11 +117,61 @@ use {
116117
thread::{sleep, Builder, JoinHandle},
117118
time::{Duration, Instant},
118119
},
120+
strum::VariantNames,
121+
strum_macros::{Display, EnumString, EnumVariantNames, IntoStaticStr},
119122
};
120123

121124
const MAX_COMPLETED_DATA_SETS_IN_CHANNEL: usize = 100_000;
122125
const WAIT_FOR_SUPERMAJORITY_THRESHOLD_PERCENT: u64 = 80;
123126

127+
#[derive(Clone, EnumString, EnumVariantNames, Default, IntoStaticStr, Display)]
128+
#[strum(serialize_all = "kebab-case")]
129+
pub enum BlockVerificationMethod {
130+
#[default]
131+
BlockstoreProcessor,
132+
}
133+
134+
impl BlockVerificationMethod {
135+
pub const fn cli_names() -> &'static [&'static str] {
136+
Self::VARIANTS
137+
}
138+
139+
pub fn cli_message() -> &'static str {
140+
lazy_static! {
141+
static ref MESSAGE: String = format!(
142+
"Switch transaction scheduling method for verifying ledger entries [default: {}]",
143+
BlockVerificationMethod::default()
144+
);
145+
};
146+
147+
&MESSAGE
148+
}
149+
}
150+
151+
#[derive(Clone, EnumString, EnumVariantNames, Default, IntoStaticStr, Display)]
152+
#[strum(serialize_all = "kebab-case")]
153+
pub enum BlockProductionMethod {
154+
#[default]
155+
ThreadLocalMultiIterator,
156+
}
157+
158+
impl BlockProductionMethod {
159+
pub const fn cli_names() -> &'static [&'static str] {
160+
Self::VARIANTS
161+
}
162+
163+
pub fn cli_message() -> &'static str {
164+
lazy_static! {
165+
static ref MESSAGE: String = format!(
166+
"Switch transaction scheduling method for producing ledger entries [default: {}]",
167+
BlockProductionMethod::default()
168+
);
169+
};
170+
171+
&MESSAGE
172+
}
173+
}
174+
124175
pub struct ValidatorConfig {
125176
pub halt_at_slot: Option<Slot>,
126177
pub expected_genesis_hash: Option<Hash>,
@@ -184,6 +235,8 @@ pub struct ValidatorConfig {
184235
pub runtime_config: RuntimeConfig,
185236
pub replay_slots_concurrently: bool,
186237
pub banking_trace_dir_byte_limit: banking_trace::DirByteLimit,
238+
pub block_verification_method: BlockVerificationMethod,
239+
pub block_production_method: BlockProductionMethod,
187240
}
188241

189242
impl Default for ValidatorConfig {
@@ -248,6 +301,8 @@ impl Default for ValidatorConfig {
248301
runtime_config: RuntimeConfig::default(),
249302
replay_slots_concurrently: false,
250303
banking_trace_dir_byte_limit: 0,
304+
block_verification_method: BlockVerificationMethod::default(),
305+
block_production_method: BlockProductionMethod::default(),
251306
}
252307
}
253308
}
@@ -687,6 +742,10 @@ impl Validator {
687742
config.accounts_db_test_hash_calculation,
688743
last_full_snapshot_slot,
689744
);
745+
info!(
746+
"Using: block-verification-method: {}, block-production-method: {}",
747+
config.block_verification_method, config.block_production_method
748+
);
690749

691750
let leader_schedule_cache = Arc::new(leader_schedule_cache);
692751
let mut process_blockstore = ProcessBlockStore::new(

ledger-tool/src/main.rs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ use {
2525
},
2626
},
2727
solana_cli_output::{CliAccount, CliAccountNewConfig, OutputFormat},
28-
solana_core::system_monitor_service::{SystemMonitorService, SystemMonitorStatsReportConfig},
28+
solana_core::{
29+
system_monitor_service::{SystemMonitorService, SystemMonitorStatsReportConfig},
30+
validator::BlockVerificationMethod,
31+
},
2932
solana_entry::entry::Entry,
3033
solana_geyser_plugin_manager::geyser_plugin_service::GeyserPluginService,
3134
solana_ledger::{
@@ -1244,6 +1247,16 @@ fn load_bank_forks(
12441247
accounts_update_notifier,
12451248
&Arc::default(),
12461249
);
1250+
let block_verification_method = value_t!(
1251+
arg_matches,
1252+
"block_verification_method",
1253+
BlockVerificationMethod
1254+
)
1255+
.unwrap_or_default();
1256+
info!(
1257+
"Using: block-verification-method: {}",
1258+
block_verification_method,
1259+
);
12471260

12481261
let (snapshot_request_sender, snapshot_request_receiver) = crossbeam_channel::unbounded();
12491262
let (accounts_package_sender, _accounts_package_receiver) = crossbeam_channel::unbounded();
@@ -1695,6 +1708,16 @@ fn main() {
16951708
.global(true)
16961709
.help("Use DIR for separate incremental snapshot location"),
16971710
)
1711+
.arg(
1712+
Arg::with_name("block_verification_method")
1713+
.long("block-verification-method")
1714+
.value_name("METHOD")
1715+
.takes_value(true)
1716+
.possible_values(BlockVerificationMethod::cli_names())
1717+
.global(true)
1718+
.hidden(hidden_unless_forced())
1719+
.help(BlockVerificationMethod::cli_message()),
1720+
)
16981721
.arg(
16991722
Arg::with_name("output_format")
17001723
.long("output")

local-cluster/src/validator_configs.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ pub fn safe_clone_config(config: &ValidatorConfig) -> ValidatorConfig {
6666
runtime_config: config.runtime_config.clone(),
6767
replay_slots_concurrently: config.replay_slots_concurrently,
6868
banking_trace_dir_byte_limit: config.banking_trace_dir_byte_limit,
69+
block_verification_method: config.block_verification_method.clone(),
70+
block_production_method: config.block_production_method.clone(),
6971
}
7072
}
7173

programs/sbf/Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

validator/src/cli.rs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ use {
1111
},
1212
keypair::SKIP_SEED_PHRASE_VALIDATION_ARG,
1313
},
14-
solana_core::banking_trace::{DirByteLimit, BANKING_TRACE_DIR_DEFAULT_BYTE_LIMIT},
14+
solana_core::{
15+
banking_trace::{DirByteLimit, BANKING_TRACE_DIR_DEFAULT_BYTE_LIMIT},
16+
validator::{BlockProductionMethod, BlockVerificationMethod},
17+
},
1518
solana_faucet::faucet::{self, FAUCET_PORT},
1619
solana_net_utils::{MINIMUM_VALIDATOR_PORT_RANGE_WIDTH, VALIDATOR_PORT_RANGE},
1720
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> {
13401343
up to the default or specified total bytes in the \
13411344
ledger")
13421345
)
1346+
.arg(
1347+
Arg::with_name("block_verification_method")
1348+
.long("block-verification-method")
1349+
.hidden(hidden_unless_forced())
1350+
.value_name("METHOD")
1351+
.takes_value(true)
1352+
.possible_values(BlockVerificationMethod::cli_names())
1353+
.help(BlockVerificationMethod::cli_message())
1354+
)
1355+
.arg(
1356+
Arg::with_name("block_production_method")
1357+
.long("block-production-method")
1358+
.hidden(hidden_unless_forced())
1359+
.value_name("METHOD")
1360+
.takes_value(true)
1361+
.possible_values(BlockProductionMethod::cli_names())
1362+
.help(BlockProductionMethod::cli_message())
1363+
)
13431364
.args(&get_deprecated_arguments())
13441365
.after_help("The default subcommand is run")
13451366
.subcommand(

validator/src/main.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ use {
1414
system_monitor_service::SystemMonitorService,
1515
tower_storage,
1616
tpu::DEFAULT_TPU_COALESCE_MS,
17-
validator::{is_snapshot_config_valid, Validator, ValidatorConfig, ValidatorStartProgress},
17+
validator::{
18+
is_snapshot_config_valid, BlockProductionMethod, BlockVerificationMethod, Validator,
19+
ValidatorConfig, ValidatorStartProgress,
20+
},
1821
},
1922
solana_gossip::{cluster_info::Node, legacy_contact_info::LegacyContactInfo as ContactInfo},
2023
solana_ledger::blockstore_options::{
@@ -1526,6 +1529,18 @@ pub fn main() {
15261529
}
15271530

15281531
configure_banking_trace_dir_byte_limit(&mut validator_config, &matches);
1532+
validator_config.block_verification_method = value_t!(
1533+
matches,
1534+
"block_verification_method",
1535+
BlockVerificationMethod
1536+
)
1537+
.unwrap_or_default();
1538+
validator_config.block_production_method = value_t!(
1539+
matches, // comment to align formatting...
1540+
"block_production_method",
1541+
BlockProductionMethod
1542+
)
1543+
.unwrap_or_default();
15291544

15301545
validator_config.ledger_column_options = LedgerColumnOptions {
15311546
compression_type: match matches.value_of("rocksdb_ledger_compression") {

0 commit comments

Comments
 (0)