Skip to content

Commit 8cba6cc

Browse files
rpc-send-tx-svc server-side retry knobs (backport solana-labs#20818) (solana-labs#20830)
* rpc-send-tx-svc: add with_config constructor (cherry picked from commit fe098b5) # Conflicts: # Cargo.lock # core/Cargo.toml # replica-node/Cargo.toml # rpc/src/rpc_service.rs # rpc/src/send_transaction_service.rs # validator/Cargo.toml * rpc-send-tx-svc: server-side retry knobs (cherry picked from commit 2744a21) Co-authored-by: Trent Nelson <trent@solana.com>
1 parent 85048c6 commit 8cba6cc

File tree

5 files changed

+141
-59
lines changed

5 files changed

+141
-59
lines changed

core/src/validator.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ use {
4545
poh_recorder::{PohRecorder, GRACE_TICKS_FACTOR, MAX_GRACE_SLOTS},
4646
poh_service::{self, PohService},
4747
},
48+
solana_rpc::send_transaction_service,
4849
solana_rpc::{
4950
max_slots::MaxSlots,
5051
optimistically_confirmed_bank_tracker::{
@@ -138,8 +139,7 @@ pub struct ValidatorConfig {
138139
pub contact_debug_interval: u64,
139140
pub contact_save_interval: u64,
140141
pub bpf_jit: bool,
141-
pub send_transaction_retry_ms: u64,
142-
pub send_transaction_leader_forward_count: u64,
142+
pub send_transaction_service_config: send_transaction_service::Config,
143143
pub no_poh_speed_test: bool,
144144
pub poh_pinned_cpu_core: usize,
145145
pub poh_hashes_per_batch: u64,
@@ -197,8 +197,7 @@ impl Default for ValidatorConfig {
197197
contact_debug_interval: DEFAULT_CONTACT_DEBUG_INTERVAL_MILLIS,
198198
contact_save_interval: DEFAULT_CONTACT_SAVE_INTERVAL_MILLIS,
199199
bpf_jit: false,
200-
send_transaction_retry_ms: 2000,
201-
send_transaction_leader_forward_count: 2,
200+
send_transaction_service_config: send_transaction_service::Config::default(),
202201
no_poh_speed_test: true,
203202
poh_pinned_cpu_core: poh_service::DEFAULT_PINNED_CPU_CORE,
204203
poh_hashes_per_batch: poh_service::DEFAULT_HASHES_PER_BATCH,
@@ -592,8 +591,7 @@ impl Validator {
592591
config.trusted_validators.clone(),
593592
rpc_override_health_check.clone(),
594593
optimistically_confirmed_bank.clone(),
595-
config.send_transaction_retry_ms,
596-
config.send_transaction_leader_forward_count,
594+
config.send_transaction_service_config.clone(),
597595
max_slots.clone(),
598596
leader_schedule_cache.clone(),
599597
max_complete_transaction_status_slot,

local-cluster/src/validator_configs.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ pub fn safe_clone_config(config: &ValidatorConfig) -> ValidatorConfig {
4343
contact_debug_interval: config.contact_debug_interval,
4444
contact_save_interval: config.contact_save_interval,
4545
bpf_jit: config.bpf_jit,
46-
send_transaction_retry_ms: config.send_transaction_retry_ms,
47-
send_transaction_leader_forward_count: config.send_transaction_leader_forward_count,
46+
send_transaction_service_config: config.send_transaction_service_config.clone(),
4847
no_poh_speed_test: config.no_poh_speed_test,
4948
poh_pinned_cpu_core: config.poh_pinned_cpu_core,
5049
account_indexes: config.account_indexes.clone(),

rpc/src/rpc_service.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use {
66
optimistically_confirmed_bank_tracker::OptimisticallyConfirmedBank,
77
rpc::{rpc_deprecated_v1_7::*, rpc_full::*, rpc_minimal::*, rpc_obsolete_v1_7::*, *},
88
rpc_health::*,
9-
send_transaction_service::{LeaderInfo, SendTransactionService},
9+
send_transaction_service::{self, LeaderInfo, SendTransactionService},
1010
},
1111
jsonrpc_core::{futures::prelude::*, MetaIoHandler},
1212
jsonrpc_http_server::{
@@ -280,8 +280,7 @@ impl JsonRpcService {
280280
trusted_validators: Option<HashSet<Pubkey>>,
281281
override_health_check: Arc<AtomicBool>,
282282
optimistically_confirmed_bank: Arc<RwLock<OptimisticallyConfirmedBank>>,
283-
send_transaction_retry_ms: u64,
284-
send_transaction_leader_forward_count: u64,
283+
send_transaction_service_config: send_transaction_service::Config,
285284
max_slots: Arc<MaxSlots>,
286285
leader_schedule_cache: Arc<LeaderScheduleCache>,
287286
current_transaction_status_slot: Arc<AtomicU64>,
@@ -378,13 +377,12 @@ impl JsonRpcService {
378377

379378
let leader_info =
380379
poh_recorder.map(|recorder| LeaderInfo::new(cluster_info.clone(), recorder));
381-
let _send_transaction_service = Arc::new(SendTransactionService::new(
380+
let _send_transaction_service = Arc::new(SendTransactionService::new_with_config(
382381
tpu_address,
383382
&bank_forks,
384383
leader_info,
385384
receiver,
386-
send_transaction_retry_ms,
387-
send_transaction_leader_forward_count,
385+
send_transaction_service_config,
388386
));
389387

390388
#[cfg(test)]
@@ -540,8 +538,11 @@ mod tests {
540538
None,
541539
Arc::new(AtomicBool::new(false)),
542540
optimistically_confirmed_bank,
543-
1000,
544-
1,
541+
send_transaction_service::Config {
542+
retry_rate_ms: 1000,
543+
leader_forward_count: 1,
544+
..send_transaction_service::Config::default()
545+
},
545546
Arc::new(MaxSlots::default()),
546547
Arc::new(LeaderScheduleCache::default()),
547548
Arc::new(AtomicU64::default()),

0 commit comments

Comments
 (0)