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

Commit 411f0a3

Browse files
committed
Revert "Added option to turn on UDP for TPU transaction and make UDP based TPU off by default (backport #27462) (#27658)"
This reverts commit 1bbace4.
1 parent 4e2b4b7 commit 411f0a3

File tree

12 files changed

+36
-135
lines changed

12 files changed

+36
-135
lines changed

client/src/connection_cache.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ pub const DEFAULT_TPU_USE_QUIC: bool = true;
3737
/// Default TPU connection pool size per remote address
3838
pub const DEFAULT_TPU_CONNECTION_POOL_SIZE: usize = 4;
3939

40-
pub const DEFAULT_TPU_ENABLE_UDP: bool = false;
41-
4240
#[derive(Default)]
4341
pub struct ConnectionCacheStats {
4442
cache_hits: AtomicU64,

core/src/fetch_stage.rs

Lines changed: 30 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use {
66
result::{Error, Result},
77
},
88
crossbeam_channel::{unbounded, RecvTimeoutError},
9-
solana_client::connection_cache::DEFAULT_TPU_ENABLE_UDP,
109
solana_metrics::{inc_new_counter_debug, inc_new_counter_info},
1110
solana_perf::{packet::PacketBatchRecycler, recycler::Recycler},
1211
solana_poh::poh_recorder::PohRecorder,
@@ -58,7 +57,6 @@ impl FetchStage {
5857
poh_recorder,
5958
coalesce_ms,
6059
None,
61-
DEFAULT_TPU_ENABLE_UDP,
6260
),
6361
receiver,
6462
vote_receiver,
@@ -78,7 +76,6 @@ impl FetchStage {
7876
poh_recorder: &Arc<Mutex<PohRecorder>>,
7977
coalesce_ms: u64,
8078
in_vote_only_mode: Option<Arc<AtomicBool>>,
81-
tpu_enable_udp: bool,
8279
) -> Self {
8380
let tx_sockets = sockets.into_iter().map(Arc::new).collect();
8481
let tpu_forwards_sockets = tpu_forwards_sockets.into_iter().map(Arc::new).collect();
@@ -95,7 +92,6 @@ impl FetchStage {
9592
poh_recorder,
9693
coalesce_ms,
9794
in_vote_only_mode,
98-
tpu_enable_udp,
9995
)
10096
}
10197

@@ -154,52 +150,42 @@ impl FetchStage {
154150
poh_recorder: &Arc<Mutex<PohRecorder>>,
155151
coalesce_ms: u64,
156152
in_vote_only_mode: Option<Arc<AtomicBool>>,
157-
tpu_enable_udp: bool,
158153
) -> Self {
159154
let recycler: PacketBatchRecycler = Recycler::warmed(1000, 1024);
160155

161156
let tpu_stats = Arc::new(StreamerReceiveStats::new("tpu_receiver"));
162-
163-
let tpu_threads: Vec<_> = if tpu_enable_udp {
164-
tpu_sockets
165-
.into_iter()
166-
.map(|socket| {
167-
streamer::receiver(
168-
socket,
169-
exit.clone(),
170-
sender.clone(),
171-
recycler.clone(),
172-
tpu_stats.clone(),
173-
coalesce_ms,
174-
true,
175-
in_vote_only_mode.clone(),
176-
)
177-
})
178-
.collect()
179-
} else {
180-
Vec::default()
181-
};
157+
let tpu_threads: Vec<_> = tpu_sockets
158+
.into_iter()
159+
.map(|socket| {
160+
streamer::receiver(
161+
socket,
162+
exit.clone(),
163+
sender.clone(),
164+
recycler.clone(),
165+
tpu_stats.clone(),
166+
coalesce_ms,
167+
true,
168+
in_vote_only_mode.clone(),
169+
)
170+
})
171+
.collect();
182172

183173
let tpu_forward_stats = Arc::new(StreamerReceiveStats::new("tpu_forwards_receiver"));
184-
let tpu_forwards_threads: Vec<_> = if tpu_enable_udp {
185-
tpu_forwards_sockets
186-
.into_iter()
187-
.map(|socket| {
188-
streamer::receiver(
189-
socket,
190-
exit.clone(),
191-
forward_sender.clone(),
192-
recycler.clone(),
193-
tpu_forward_stats.clone(),
194-
coalesce_ms,
195-
true,
196-
in_vote_only_mode.clone(),
197-
)
198-
})
199-
.collect()
200-
} else {
201-
Vec::default()
202-
};
174+
let tpu_forwards_threads: Vec<_> = tpu_forwards_sockets
175+
.into_iter()
176+
.map(|socket| {
177+
streamer::receiver(
178+
socket,
179+
exit.clone(),
180+
forward_sender.clone(),
181+
recycler.clone(),
182+
tpu_forward_stats.clone(),
183+
coalesce_ms,
184+
true,
185+
in_vote_only_mode.clone(),
186+
)
187+
})
188+
.collect();
203189

204190
let tpu_vote_stats = Arc::new(StreamerReceiveStats::new("tpu_vote_receiver"));
205191
let tpu_vote_threads: Vec<_> = tpu_vote_sockets

core/src/tpu.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ impl Tpu {
100100
connection_cache: &Arc<ConnectionCache>,
101101
keypair: &Keypair,
102102
staked_nodes: &Arc<RwLock<StakedNodes>>,
103-
tpu_enable_udp: bool,
104103
) -> Self {
105104
let TpuSockets {
106105
transactions: transactions_sockets,
@@ -126,7 +125,6 @@ impl Tpu {
126125
poh_recorder,
127126
tpu_coalesce_ms,
128127
Some(bank_forks.read().unwrap().get_vote_only_mode_signal()),
129-
tpu_enable_udp,
130128
);
131129

132130
let staked_nodes_updater_service = StakedNodesUpdaterService::new(

core/src/validator.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,6 @@ impl Validator {
375375
socket_addr_space: SocketAddrSpace,
376376
use_quic: bool,
377377
tpu_connection_pool_size: usize,
378-
tpu_enable_udp: bool,
379378
) -> Self {
380379
let id = identity_keypair.pubkey();
381380
assert_eq!(id, node.info.id);
@@ -996,7 +995,6 @@ impl Validator {
996995
&connection_cache,
997996
&identity_keypair,
998997
&staked_nodes,
999-
tpu_enable_udp,
1000998
);
1001999

10021000
datapoint_info!(
@@ -1852,9 +1850,7 @@ mod tests {
18521850
use {
18531851
super::*,
18541852
crossbeam_channel::{bounded, RecvTimeoutError},
1855-
solana_client::connection_cache::{
1856-
DEFAULT_TPU_CONNECTION_POOL_SIZE, DEFAULT_TPU_ENABLE_UDP, DEFAULT_TPU_USE_QUIC,
1857-
},
1853+
solana_client::connection_cache::{DEFAULT_TPU_CONNECTION_POOL_SIZE, DEFAULT_TPU_USE_QUIC},
18581854
solana_ledger::{create_new_tmp_ledger, genesis_utils::create_genesis_config_with_leader},
18591855
solana_sdk::{genesis_config::create_genesis_config, poh_config::PohConfig},
18601856
std::{fs::remove_dir_all, thread, time::Duration},
@@ -1892,9 +1888,7 @@ mod tests {
18921888
SocketAddrSpace::Unspecified,
18931889
DEFAULT_TPU_USE_QUIC,
18941890
DEFAULT_TPU_CONNECTION_POOL_SIZE,
1895-
DEFAULT_TPU_ENABLE_UDP,
18961891
);
1897-
18981892
assert_eq!(
18991893
*start_progress.read().unwrap(),
19001894
ValidatorStartProgress::Running
@@ -1990,7 +1984,6 @@ mod tests {
19901984
SocketAddrSpace::Unspecified,
19911985
DEFAULT_TPU_USE_QUIC,
19921986
DEFAULT_TPU_CONNECTION_POOL_SIZE,
1993-
DEFAULT_TPU_ENABLE_UDP,
19941987
)
19951988
})
19961989
.collect();

local-cluster/src/local_cluster.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ use {
88
log::*,
99
solana_client::{
1010
connection_cache::{
11-
ConnectionCache, DEFAULT_TPU_CONNECTION_POOL_SIZE, DEFAULT_TPU_ENABLE_UDP,
12-
DEFAULT_TPU_USE_QUIC,
11+
ConnectionCache, DEFAULT_TPU_CONNECTION_POOL_SIZE, DEFAULT_TPU_USE_QUIC,
1312
},
1413
thin_client::ThinClient,
1514
},
@@ -261,7 +260,6 @@ impl LocalCluster {
261260
socket_addr_space,
262261
DEFAULT_TPU_USE_QUIC,
263262
DEFAULT_TPU_CONNECTION_POOL_SIZE,
264-
DEFAULT_TPU_ENABLE_UDP,
265263
);
266264

267265
let mut validators = HashMap::new();
@@ -461,7 +459,6 @@ impl LocalCluster {
461459
socket_addr_space,
462460
DEFAULT_TPU_USE_QUIC,
463461
DEFAULT_TPU_CONNECTION_POOL_SIZE,
464-
DEFAULT_TPU_ENABLE_UDP,
465462
);
466463

467464
let validator_pubkey = validator_keypair.pubkey();
@@ -810,7 +807,6 @@ impl Cluster for LocalCluster {
810807
socket_addr_space,
811808
DEFAULT_TPU_USE_QUIC,
812809
DEFAULT_TPU_CONNECTION_POOL_SIZE,
813-
DEFAULT_TPU_ENABLE_UDP,
814810
);
815811
cluster_validator_info.validator = Some(restarted_node);
816812
cluster_validator_info

multinode-demo/bootstrap-validator.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ while [[ -n $1 ]]; do
6161
elif [[ $1 = --tpu-disable-quic ]]; then
6262
args+=("$1")
6363
shift
64-
elif [[ $1 = --tpu-enable-udp ]]; then
65-
args+=("$1")
66-
shift
6764
elif [[ $1 = --rpc-send-batch-ms ]]; then
6865
args+=("$1" "$2")
6966
shift 2

multinode-demo/validator.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,6 @@ while [[ -n $1 ]]; do
147147
elif [[ $1 = --tpu-use-quic ]]; then
148148
args+=("$1")
149149
shift
150-
elif [[ $1 = --tpu-enable-udp ]]; then
151-
args+=("$1")
152-
shift
153150
elif [[ $1 = --rpc-send-batch-ms ]]; then
154151
args+=("$1" "$2")
155152
shift 2

net/net.sh

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,6 @@ Operate a configured testnet
107107
- Boot from a snapshot that has warped ahead to WARP_SLOT rather than a slot 0 genesis.
108108
--full-rpc
109109
- Support full RPC services on all nodes
110-
111-
--tpu-enable-udp
112-
- Enable UDP for tpu transactions
113-
114110
sanity/start-specific options:
115111
-F - Discard validator nodes that didn't bootup successfully
116112
-o noInstallCheck - Skip solana-install sanity
@@ -320,7 +316,6 @@ startBootstrapLeader() {
320316
\"$waitForNodeInit\" \
321317
\"$extraPrimordialStakes\" \
322318
\"$TMPFS_ACCOUNTS\" \
323-
\"$enableUdp\" \
324319
"
325320

326321
) >> "$logFile" 2>&1 || {
@@ -393,7 +388,6 @@ startNode() {
393388
\"$waitForNodeInit\" \
394389
\"$extraPrimordialStakes\" \
395390
\"$TMPFS_ACCOUNTS\" \
396-
\"$enableUdp\" \
397391
"
398392
) >> "$logFile" 2>&1 &
399393
declare pid=$!
@@ -801,7 +795,6 @@ maybeWarpSlot=
801795
maybeFullRpc=false
802796
waitForNodeInit=true
803797
extraPrimordialStakes=0
804-
enableUdp=false
805798

806799
command=$1
807800
[[ -n $command ]] || usage
@@ -911,9 +904,6 @@ while [[ -n $1 ]]; do
911904
elif [[ $1 == --full-rpc ]]; then
912905
maybeFullRpc=true
913906
shift 1
914-
elif [[ $1 == --tpu-enable-udp ]]; then
915-
enableUdp=true
916-
shift 1
917907
elif [[ $1 == --async-node-init ]]; then
918908
waitForNodeInit=false
919909
shift 1

net/remote/remote-node.sh

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ maybeFullRpc="${19}"
2828
waitForNodeInit="${20}"
2929
extraPrimordialStakes="${21:=0}"
3030
tmpfsAccounts="${22:false}"
31-
enableUdp="${23}"
32-
3331
set +x
3432

3533
missing() {
@@ -285,10 +283,6 @@ EOF
285283
args+=(--enable-cpi-and-log-storage)
286284
fi
287285

288-
if $enableUdp; then
289-
args+=(--tpu-enable-udp)
290-
fi
291-
292286
if [[ $airdropsEnabled = true ]]; then
293287
cat >> ~/solana/on-reboot <<EOF
294288
./multinode-demo/faucet.sh > faucet.log 2>&1 &
@@ -417,10 +411,6 @@ EOF
417411
args+=(--enable-cpi-and-log-storage)
418412
fi
419413

420-
if $enableUdp; then
421-
args+=(--tpu-enable-udp)
422-
fi
423-
424414
cat >> ~/solana/on-reboot <<EOF
425415
$maybeSkipAccountsCreation
426416
nohup multinode-demo/validator.sh ${args[@]} > validator.log.\$now 2>&1 &

rpc-test/tests/rpc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ fn test_rpc_subscriptions() {
237237

238238
let alice = Keypair::new();
239239
let test_validator =
240-
TestValidator::with_no_fees_udp(alice.pubkey(), None, SocketAddrSpace::Unspecified);
240+
TestValidator::with_no_fees(alice.pubkey(), None, SocketAddrSpace::Unspecified);
241241

242242
let transactions_socket = UdpSocket::bind("0.0.0.0:0").unwrap();
243243
transactions_socket.connect(test_validator.tpu()).unwrap();

test-validator/src/lib.rs

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ use {
33
log::*,
44
solana_cli_output::CliAccount,
55
solana_client::{
6-
connection_cache::{
7-
DEFAULT_TPU_CONNECTION_POOL_SIZE, DEFAULT_TPU_ENABLE_UDP, DEFAULT_TPU_USE_QUIC,
8-
},
6+
connection_cache::{DEFAULT_TPU_CONNECTION_POOL_SIZE, DEFAULT_TPU_USE_QUIC},
97
nonblocking,
108
rpc_client::RpcClient,
119
},
@@ -117,7 +115,6 @@ pub struct TestValidatorGenesis {
117115
pub geyser_plugin_config_files: Option<Vec<PathBuf>>,
118116
pub accounts_db_caching_enabled: bool,
119117
deactivate_feature_set: HashSet<Pubkey>,
120-
pub tpu_enable_udp: bool,
121118
}
122119

123120
impl Default for TestValidatorGenesis {
@@ -145,7 +142,6 @@ impl Default for TestValidatorGenesis {
145142
geyser_plugin_config_files: Option::<Vec<PathBuf>>::default(),
146143
accounts_db_caching_enabled: bool::default(),
147144
deactivate_feature_set: HashSet::<Pubkey>::default(),
148-
tpu_enable_udp: DEFAULT_TPU_ENABLE_UDP,
149145
}
150146
}
151147
}
@@ -173,11 +169,6 @@ impl TestValidatorGenesis {
173169
ledger_path.join("vote-account-keypair.json").exists()
174170
}
175171

176-
pub fn tpu_enable_udp(&mut self, tpu_enable_udp: bool) -> &mut Self {
177-
self.tpu_enable_udp = tpu_enable_udp;
178-
self
179-
}
180-
181172
pub fn fee_rate_governor(&mut self, fee_rate_governor: FeeRateGovernor) -> &mut Self {
182173
self.fee_rate_governor = fee_rate_governor;
183174
self
@@ -494,25 +485,6 @@ impl TestValidator {
494485
.expect("validator start failed")
495486
}
496487

497-
/// Create a test validator using udp for TPU.
498-
pub fn with_no_fees_udp(
499-
mint_address: Pubkey,
500-
faucet_addr: Option<SocketAddr>,
501-
socket_addr_space: SocketAddrSpace,
502-
) -> Self {
503-
TestValidatorGenesis::default()
504-
.tpu_enable_udp(true)
505-
.fee_rate_governor(FeeRateGovernor::new(0, 0))
506-
.rent(Rent {
507-
lamports_per_byte_year: 1,
508-
exemption_threshold: 1.0,
509-
..Rent::default()
510-
})
511-
.faucet_addr(faucet_addr)
512-
.start_with_mint_address(mint_address, socket_addr_space)
513-
.expect("validator start failed")
514-
}
515-
516488
/// Create and start a `TestValidator` with custom transaction fees and minimal rent.
517489
/// Faucet optional.
518490
///
@@ -756,7 +728,6 @@ impl TestValidator {
756728
socket_addr_space,
757729
DEFAULT_TPU_USE_QUIC,
758730
DEFAULT_TPU_CONNECTION_POOL_SIZE,
759-
config.tpu_enable_udp,
760731
));
761732

762733
// Needed to avoid panics in `solana-responder-gossip` in tests that create a number of

0 commit comments

Comments
 (0)