@@ -124,7 +124,10 @@ use {
124
124
timing:: timestamp,
125
125
} ,
126
126
solana_send_transaction_service:: send_transaction_service,
127
- solana_streamer:: { socket:: SocketAddrSpace , streamer:: StakedNodes } ,
127
+ solana_streamer:: { quic:: QuicServerParams , socket:: SocketAddrSpace , streamer:: StakedNodes } ,
128
+ solana_tpu_client:: tpu_client:: {
129
+ DEFAULT_TPU_CONNECTION_POOL_SIZE , DEFAULT_TPU_USE_QUIC , DEFAULT_VOTE_USE_QUIC ,
130
+ } ,
128
131
solana_turbine:: { self , broadcast_stage:: BroadcastStageType } ,
129
132
solana_unified_scheduler_pool:: DefaultSchedulerPool ,
130
133
solana_vote_program:: vote_state,
@@ -510,8 +513,42 @@ pub struct ValidatorTpuConfig {
510
513
pub tpu_connection_pool_size : usize ,
511
514
/// Controls if to enable UDP for TPU tansactions.
512
515
pub tpu_enable_udp : bool ,
513
- /// Controls the new maximum connections per IpAddr per minute
514
- pub tpu_max_connections_per_ipaddr_per_minute : u64 ,
516
+ /// QUIC server config for regular TPU
517
+ pub tpu_quic_server_config : QuicServerParams ,
518
+ /// QUIC server config for TPU forward
519
+ pub tpu_fwd_quic_server_config : QuicServerParams ,
520
+ /// QUIC server config for Vote
521
+ pub vote_quic_server_config : QuicServerParams ,
522
+ }
523
+
524
+ impl ValidatorTpuConfig {
525
+ /// A convenient function to build a ValidatorTpuConfig for testing with good
526
+ /// default.
527
+ pub fn new_for_tests ( tpu_enable_udp : bool ) -> Self {
528
+ let tpu_quic_server_config = QuicServerParams {
529
+ max_connections_per_ipaddr_per_min : 32 ,
530
+ ..Default :: default ( )
531
+ } ;
532
+
533
+ let tpu_fwd_quic_server_config = QuicServerParams {
534
+ max_connections_per_ipaddr_per_min : 32 ,
535
+ max_unstaked_connections : 0 ,
536
+ ..Default :: default ( )
537
+ } ;
538
+
539
+ // vote and tpu_fwd share the same characteristics -- disallow non-staked connections:
540
+ let vote_quic_server_config = tpu_fwd_quic_server_config. clone ( ) ;
541
+
542
+ ValidatorTpuConfig {
543
+ use_quic : DEFAULT_TPU_USE_QUIC ,
544
+ vote_use_quic : DEFAULT_VOTE_USE_QUIC ,
545
+ tpu_connection_pool_size : DEFAULT_TPU_CONNECTION_POOL_SIZE ,
546
+ tpu_enable_udp,
547
+ tpu_quic_server_config,
548
+ tpu_fwd_quic_server_config,
549
+ vote_quic_server_config,
550
+ }
551
+ }
515
552
}
516
553
517
554
pub struct Validator {
@@ -573,7 +610,9 @@ impl Validator {
573
610
vote_use_quic,
574
611
tpu_connection_pool_size,
575
612
tpu_enable_udp,
576
- tpu_max_connections_per_ipaddr_per_minute,
613
+ tpu_quic_server_config,
614
+ tpu_fwd_quic_server_config,
615
+ vote_quic_server_config,
577
616
} = tpu_config;
578
617
579
618
let start_time = Instant :: now ( ) ;
@@ -1548,7 +1587,9 @@ impl Validator {
1548
1587
banking_tracer,
1549
1588
tracer_thread,
1550
1589
tpu_enable_udp,
1551
- tpu_max_connections_per_ipaddr_per_minute,
1590
+ tpu_quic_server_config,
1591
+ tpu_fwd_quic_server_config,
1592
+ vote_quic_server_config,
1552
1593
& prioritization_fee_cache,
1553
1594
config. block_production_method . clone ( ) ,
1554
1595
config. transaction_struct . clone ( ) ,
@@ -2751,10 +2792,7 @@ mod tests {
2751
2792
get_tmp_ledger_path_auto_delete,
2752
2793
} ,
2753
2794
solana_sdk:: { genesis_config:: create_genesis_config, poh_config:: PohConfig } ,
2754
- solana_tpu_client:: tpu_client:: {
2755
- DEFAULT_TPU_CONNECTION_POOL_SIZE , DEFAULT_TPU_ENABLE_UDP , DEFAULT_TPU_USE_QUIC ,
2756
- DEFAULT_VOTE_USE_QUIC ,
2757
- } ,
2795
+ solana_tpu_client:: tpu_client:: DEFAULT_TPU_ENABLE_UDP ,
2758
2796
std:: { fs:: remove_dir_all, thread, time:: Duration } ,
2759
2797
} ;
2760
2798
@@ -2792,13 +2830,7 @@ mod tests {
2792
2830
None , // rpc_to_plugin_manager_receiver
2793
2831
start_progress. clone ( ) ,
2794
2832
SocketAddrSpace :: Unspecified ,
2795
- ValidatorTpuConfig {
2796
- use_quic : DEFAULT_TPU_USE_QUIC ,
2797
- vote_use_quic : DEFAULT_VOTE_USE_QUIC ,
2798
- tpu_connection_pool_size : DEFAULT_TPU_CONNECTION_POOL_SIZE ,
2799
- tpu_enable_udp : DEFAULT_TPU_ENABLE_UDP ,
2800
- tpu_max_connections_per_ipaddr_per_minute : 32 , // max connections per IpAddr per minute for test
2801
- } ,
2833
+ ValidatorTpuConfig :: new_for_tests ( DEFAULT_TPU_ENABLE_UDP ) ,
2802
2834
Arc :: new ( RwLock :: new ( None ) ) ,
2803
2835
)
2804
2836
. expect ( "assume successful validator start" ) ;
@@ -3014,13 +3046,7 @@ mod tests {
3014
3046
None , // rpc_to_plugin_manager_receiver
3015
3047
Arc :: new ( RwLock :: new ( ValidatorStartProgress :: default ( ) ) ) ,
3016
3048
SocketAddrSpace :: Unspecified ,
3017
- ValidatorTpuConfig {
3018
- use_quic : DEFAULT_TPU_USE_QUIC ,
3019
- vote_use_quic : DEFAULT_VOTE_USE_QUIC ,
3020
- tpu_connection_pool_size : DEFAULT_TPU_CONNECTION_POOL_SIZE ,
3021
- tpu_enable_udp : DEFAULT_TPU_ENABLE_UDP ,
3022
- tpu_max_connections_per_ipaddr_per_minute : 32 , // max connections per IpAddr per minute for test
3023
- } ,
3049
+ ValidatorTpuConfig :: new_for_tests ( DEFAULT_TPU_ENABLE_UDP ) ,
3024
3050
Arc :: new ( RwLock :: new ( None ) ) ,
3025
3051
)
3026
3052
. expect ( "assume successful validator start" )
0 commit comments