From 2c2ef0d3b23b12fb909f0000298171370c66cd21 Mon Sep 17 00:00:00 2001 From: Andrew Fitzgerald Date: Wed, 27 Nov 2024 09:46:01 -0600 Subject: [PATCH] add cli hookup for validator --- core/src/tpu.rs | 3 ++- core/src/validator.rs | 7 +++++-- local-cluster/src/validator_configs.rs | 1 + multinode-demo/bootstrap-validator.sh | 3 +++ multinode-demo/validator.sh | 3 +++ validator/src/cli.rs | 10 +++++++++- validator/src/main.rs | 11 +++++++++-- 7 files changed, 32 insertions(+), 6 deletions(-) diff --git a/core/src/tpu.rs b/core/src/tpu.rs index ce7bc85fabe686..1cf055f397d484 100644 --- a/core/src/tpu.rs +++ b/core/src/tpu.rs @@ -118,6 +118,7 @@ impl Tpu { tpu_max_connections_per_ipaddr_per_minute: u64, prioritization_fee_cache: &Arc, block_production_method: BlockProductionMethod, + transaction_struct: TransactionStructure, enable_block_production_forwarding: bool, _generator_config: Option, /* vestigial code for replay invalidator */ ) -> (Self, Vec>) { @@ -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, diff --git a/core/src/validator.rs b/core/src/validator.rs index 369be0541dd506..90f41cf7b33776 100644 --- a/core/src/validator.rs +++ b/core/src/validator.rs @@ -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, pub use_snapshot_archives_at_startup: UseSnapshotArchivesAtStartup, @@ -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(), @@ -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(); @@ -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(), ); diff --git a/local-cluster/src/validator_configs.rs b/local-cluster/src/validator_configs.rs index e90475aad2a06f..50199be9e7172c 100644 --- a/local-cluster/src/validator_configs.rs +++ b/local-cluster/src/validator_configs.rs @@ -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, diff --git a/multinode-demo/bootstrap-validator.sh b/multinode-demo/bootstrap-validator.sh index d21ee1aaa8b73f..4285be6cac5dc1 100755 --- a/multinode-demo/bootstrap-validator.sh +++ b/multinode-demo/bootstrap-validator.sh @@ -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 diff --git a/multinode-demo/validator.sh b/multinode-demo/validator.sh index c97812c6cbb910..800b4ce9d136d2 100755 --- a/multinode-demo/validator.sh +++ b/multinode-demo/validator.sh @@ -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 diff --git a/validator/src/cli.rs b/validator/src/cli.rs index 19a2b7f77e7b0a..2607eac492c0f1 100644 --- a/validator/src/cli.rs +++ b/validator/src/cli.rs @@ -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, @@ -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") diff --git a/validator/src/main.rs b/validator/src/main.rs index bee65e487ba92a..cbdfd516bc5afa 100644 --- a/validator/src/main.rs +++ b/validator/src/main.rs @@ -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::{ @@ -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();