Skip to content

Commit

Permalink
add cli hookup for validator
Browse files Browse the repository at this point in the history
  • Loading branch information
apfitzge committed Nov 27, 2024
1 parent bda2cea commit 2c2ef0d
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 6 deletions.
3 changes: 2 additions & 1 deletion core/src/tpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ impl Tpu {
tpu_max_connections_per_ipaddr_per_minute: u64,
prioritization_fee_cache: &Arc<PrioritizationFeeCache>,
block_production_method: BlockProductionMethod,
transaction_struct: TransactionStructure,
enable_block_production_forwarding: bool,
_generator_config: Option<GeneratorConfig>, /* vestigial code for replay invalidator */
) -> (Self, Vec<Arc<dyn NotifyKeyUpdate + Sync + Send>>) {
Expand Down Expand Up @@ -266,7 +267,7 @@ impl Tpu {

let banking_stage = BankingStage::new(
block_production_method,
TransactionStructure::Sdk, // TODO: add cli
transaction_struct,
cluster_info,
poh_recorder,
non_vote_receiver,
Expand Down
7 changes: 5 additions & 2 deletions core/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ pub struct ValidatorConfig {
pub banking_trace_dir_byte_limit: banking_trace::DirByteLimit,
pub block_verification_method: BlockVerificationMethod,
pub block_production_method: BlockProductionMethod,
pub transaction_struct: TransactionStructure,
pub enable_block_production_forwarding: bool,
pub generator_config: Option<GeneratorConfig>,
pub use_snapshot_archives_at_startup: UseSnapshotArchivesAtStartup,
Expand Down Expand Up @@ -371,6 +372,7 @@ impl Default for ValidatorConfig {
banking_trace_dir_byte_limit: 0,
block_verification_method: BlockVerificationMethod::default(),
block_production_method: BlockProductionMethod::default(),
transaction_struct: TransactionStructure::default(),
enable_block_production_forwarding: false,
generator_config: None,
use_snapshot_archives_at_startup: UseSnapshotArchivesAtStartup::default(),
Expand Down Expand Up @@ -881,8 +883,8 @@ impl Validator {
config.accounts_db_test_hash_calculation,
);
info!(
"Using: block-verification-method: {}, block-production-method: {}",
config.block_verification_method, config.block_production_method
"Using: block-verification-method: {}, block-production-method: {}, transaction-structure: {}",
config.block_verification_method, config.block_production_method, config.transaction_struct
);

let (replay_vote_sender, replay_vote_receiver) = unbounded();
Expand Down Expand Up @@ -1517,6 +1519,7 @@ impl Validator {
tpu_max_connections_per_ipaddr_per_minute,
&prioritization_fee_cache,
config.block_production_method.clone(),
config.transaction_struct.clone(),
config.enable_block_production_forwarding,
config.generator_config.clone(),
);
Expand Down
1 change: 1 addition & 0 deletions local-cluster/src/validator_configs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ pub fn safe_clone_config(config: &ValidatorConfig) -> ValidatorConfig {
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(),
transaction_struct: config.transaction_struct.clone(),
enable_block_production_forwarding: config.enable_block_production_forwarding,
generator_config: config.generator_config.clone(),
use_snapshot_archives_at_startup: config.use_snapshot_archives_at_startup,
Expand Down
3 changes: 3 additions & 0 deletions multinode-demo/bootstrap-validator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ while [[ -n $1 ]]; do
elif [[ $1 == --block-production-method ]]; then
args+=("$1" "$2")
shift 2
elif [[ $1 == --transaction-structure ]]; then
args+=("$1" "$2")
shift 2
elif [[ $1 == --wen-restart ]]; then
args+=("$1" "$2")
shift 2
Expand Down
3 changes: 3 additions & 0 deletions multinode-demo/validator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ while [[ -n $1 ]]; do
elif [[ $1 == --block-production-method ]]; then
args+=("$1" "$2")
shift 2
elif [[ $1 == --transaction-structure ]]; then
args+=("$1" "$2")
shift 2
elif [[ $1 == --wen-restart ]]; then
args+=("$1" "$2")
shift 2
Expand Down
10 changes: 9 additions & 1 deletion validator/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use {
},
solana_core::{
banking_trace::{DirByteLimit, BANKING_TRACE_DIR_DEFAULT_BYTE_LIMIT},
validator::{BlockProductionMethod, BlockVerificationMethod},
validator::{BlockProductionMethod, BlockVerificationMethod, TransactionStructure},
},
solana_faucet::faucet::{self, FAUCET_PORT},
solana_ledger::use_snapshot_archives_at_startup,
Expand Down Expand Up @@ -1587,6 +1587,14 @@ pub fn app<'a>(version: &'a str, default_args: &'a DefaultArgs) -> App<'a, 'a> {
.possible_values(BlockProductionMethod::cli_names())
.help(BlockProductionMethod::cli_message()),
)
.arg(
Arg::with_name("transaction_struct")
.long("transaction-structure")
.value_name("STRUCT")
.takes_value(true)
.possible_values(TransactionStructure::cli_names())
.help(TransactionStructure::cli_message()),
)
.arg(
Arg::with_name("unified_scheduler_handler_threads")
.long("unified-scheduler-handler-threads")
Expand Down
11 changes: 9 additions & 2 deletions validator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ use {
system_monitor_service::SystemMonitorService,
tpu::DEFAULT_TPU_COALESCE,
validator::{
is_snapshot_config_valid, BlockProductionMethod, BlockVerificationMethod, Validator,
ValidatorConfig, ValidatorError, ValidatorStartProgress,
is_snapshot_config_valid, BlockProductionMethod, BlockVerificationMethod,
TransactionStructure, Validator, ValidatorConfig, ValidatorError,
ValidatorStartProgress,
},
},
solana_gossip::{
Expand Down Expand Up @@ -1846,6 +1847,12 @@ pub fn main() {
BlockProductionMethod
)
.unwrap_or_default();
validator_config.transaction_struct = value_t!(
matches, // comment to align formatting...
"transaction_struct",
TransactionStructure
)
.unwrap_or_default();
validator_config.enable_block_production_forwarding = staked_nodes_overrides_path.is_some();
validator_config.unified_scheduler_handler_threads =
value_t!(matches, "unified_scheduler_handler_threads", usize).ok();
Expand Down

0 comments on commit 2c2ef0d

Please sign in to comment.