Skip to content

Commit b51a2f5

Browse files
committed
chore: remove deprecated UDP TPU socket bindings
Signed-Off-By: AvhiMaz<[email protected]>
1 parent cd96cc2 commit b51a2f5

File tree

7 files changed

+13
-69
lines changed

7 files changed

+13
-69
lines changed

core/src/repair/serve_repair.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1950,7 +1950,6 @@ mod tests {
19501950
);
19511951
nxt.set_gossip((Ipv4Addr::LOCALHOST, 1234)).unwrap();
19521952
nxt.set_tvu(UDP, (Ipv4Addr::LOCALHOST, 1235)).unwrap();
1953-
nxt.set_tvu(QUIC, (Ipv4Addr::LOCALHOST, 1236)).unwrap();
19541953
nxt.set_rpc((Ipv4Addr::LOCALHOST, 1241)).unwrap();
19551954
nxt.set_rpc_pubsub((Ipv4Addr::LOCALHOST, 1242)).unwrap();
19561955
nxt.set_serve_repair(UDP, serve_repair_addr2).unwrap();

gossip/src/cluster_info.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -596,10 +596,10 @@ impl ClusterInfo {
596596
},
597597
self.addr_to_string(&ip_addr, &node.gossip()),
598598
self.addr_to_string(&ip_addr, &node.tpu_vote(contact_info::Protocol::UDP)),
599-
self.addr_to_string(&ip_addr, &node.tpu(contact_info::Protocol::UDP)),
599+
self.addr_to_string(&ip_addr, &node.tpu(contact_info::Protocol::QUIC)),
600600
self.addr_to_string(
601601
&ip_addr,
602-
&node.tpu_forwards(contact_info::Protocol::UDP)
602+
&node.tpu_forwards(contact_info::Protocol::QUIC)
603603
),
604604
self.addr_to_string(&ip_addr, &node.tvu(contact_info::Protocol::UDP)),
605605
self.addr_to_string(
@@ -1144,7 +1144,7 @@ impl ClusterInfo {
11441144

11451145
fn is_spy_node(node: &ContactInfo, socket_addr_space: &SocketAddrSpace) -> bool {
11461146
![
1147-
node.tpu(contact_info::Protocol::UDP),
1147+
node.tpu(contact_info::Protocol::QUIC),
11481148
node.gossip(),
11491149
node.tvu(contact_info::Protocol::UDP),
11501150
]
@@ -1163,7 +1163,7 @@ impl ClusterInfo {
11631163
.get_nodes_contact_info()
11641164
.filter(|node| {
11651165
node.pubkey() != &self_pubkey
1166-
&& self.check_socket_addr_space(&node.tpu(contact_info::Protocol::UDP))
1166+
&& self.check_socket_addr_space(&node.tpu(contact_info::Protocol::QUIC))
11671167
})
11681168
.cloned()
11691169
.collect()
@@ -2367,8 +2367,6 @@ pub struct Sockets {
23672367
pub gossip: Arc<[UdpSocket]>,
23682368
pub ip_echo: Option<TcpListener>,
23692369
pub tvu: Vec<UdpSocket>,
2370-
pub tpu: Vec<UdpSocket>,
2371-
pub tpu_forwards: Vec<UdpSocket>,
23722370
pub tpu_vote: Vec<UdpSocket>,
23732371
pub broadcast: Vec<UdpSocket>,
23742372
// Socket sending out local repair requests,
@@ -2867,7 +2865,6 @@ mod tests {
28672865
}
28682866
check_sockets(&node.sockets.gossip, ip, range);
28692867
check_sockets(&node.sockets.tvu, ip, range);
2870-
check_sockets(&node.sockets.tpu, ip, range);
28712868
}
28722869

28732870
#[test]

gossip/src/contact_info.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -442,10 +442,7 @@ impl ContactInfo {
442442
let mut node = Self::new(*pubkey, wallclock, /*shred_version:*/ 0u16);
443443
node.set_gossip((Ipv4Addr::LOCALHOST, 8000)).unwrap();
444444
node.set_tvu(UDP, (Ipv4Addr::LOCALHOST, 8001)).unwrap();
445-
node.set_tpu(UDP, (Ipv4Addr::LOCALHOST, 8003)).unwrap();
446445
node.set_tpu(QUIC, (Ipv4Addr::LOCALHOST, 8009)).unwrap();
447-
node.set_tpu_forwards(UDP, (Ipv4Addr::LOCALHOST, 8004))
448-
.unwrap();
449446
node.set_tpu_forwards(QUIC, (Ipv4Addr::LOCALHOST, 8010))
450447
.unwrap();
451448
node.set_tpu_vote(UDP, (Ipv4Addr::LOCALHOST, 8005)).unwrap();
@@ -474,10 +471,7 @@ impl ContactInfo {
474471
let (addr, port) = (socket.ip(), socket.port());
475472
node.set_gossip((addr, port + 1)).unwrap();
476473
node.set_tvu(UDP, (addr, port + 2)).unwrap();
477-
node.set_tvu(QUIC, (addr, port + 3)).unwrap();
478-
node.set_tpu(UDP, (addr, port)).unwrap();
479474
node.set_tpu(QUIC, (addr, port + 6)).unwrap();
480-
node.set_tpu_forwards(UDP, (addr, port + 5)).unwrap();
481475
node.set_tpu_forwards(QUIC, (addr, port + 11)).unwrap();
482476
node.set_tpu_vote(UDP, (addr, port + 7)).unwrap();
483477
node.set_tpu_vote(QUIC, (addr, port + 9)).unwrap();
@@ -903,18 +897,10 @@ mod tests {
903897
node.serve_repair(Protocol::QUIC).as_ref(),
904898
sockets.get(&SOCKET_TAG_SERVE_REPAIR_QUIC)
905899
);
906-
assert_eq!(
907-
node.tpu(Protocol::UDP).as_ref(),
908-
sockets.get(&SOCKET_TAG_TPU)
909-
);
910900
assert_eq!(
911901
node.tpu(Protocol::QUIC).as_ref(),
912902
sockets.get(&SOCKET_TAG_TPU_QUIC)
913903
);
914-
assert_eq!(
915-
node.tpu_forwards(Protocol::UDP).as_ref(),
916-
sockets.get(&SOCKET_TAG_TPU_FORWARDS)
917-
);
918904
assert_eq!(
919905
node.tpu_forwards(Protocol::QUIC).as_ref(),
920906
sockets.get(&SOCKET_TAG_TPU_FORWARDS_QUIC)

gossip/src/crds_gossip_pull.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1583,7 +1583,7 @@ pub(crate) mod tests {
15831583
};
15841584
{
15851585
let caller = CrdsValue::new(CrdsData::from(&node), &keypair);
1586-
assert_eq!(get_max_bloom_filter_bytes(&caller), 1155);
1586+
assert_eq!(get_max_bloom_filter_bytes(&caller), 1165);
15871587
verify_get_max_bloom_filter_bytes(&mut rng, &caller, num_items);
15881588
}
15891589
}

gossip/src/node.rs

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,6 @@ impl Node {
128128
);
129129
let tvu_addresses = Self::get_socket_addrs(&tvu_sockets);
130130

131-
let (tpu_port, tpu_socket) =
132-
bind_in_range_with_config(bind_ip_addr, port_range, socket_config)
133-
.expect("tpu_socket primary bind");
134-
let tpu_sockets =
135-
bind_more_with_config(tpu_socket, 32, socket_config).expect("tpu_sockets multi_bind");
136-
137131
let (tpu_port_quic, tpu_quic) =
138132
bind_in_range_with_config(bind_ip_addr, port_range, socket_config)
139133
.expect("tpu_quic primary bind");
@@ -147,11 +141,6 @@ impl Node {
147141
);
148142
let tpu_quic_addresses = Self::get_socket_addrs(&tpu_quic);
149143

150-
let (tpu_forwards_port, tpu_forwards_socket) =
151-
bind_in_range_with_config(bind_ip_addr, port_range, socket_config)
152-
.expect("tpu_forwards primary bind");
153-
let tpu_forwards_sockets = bind_more_with_config(tpu_forwards_socket, 8, socket_config)
154-
.expect("tpu_forwards multi_bind");
155144
let (tpu_forwards_quic_port, tpu_forwards_quic) =
156145
bind_in_range_with_config(bind_ip_addr, port_range, socket_config)
157146
.expect("tpu_forwards_quic primary bind");
@@ -290,14 +279,11 @@ impl Node {
290279
public_tvu_addr.unwrap_or_else(|| SocketAddr::new(advertised_ip, tvu_port)),
291280
)
292281
.unwrap();
293-
info.set_tpu(UDP, (advertised_ip, tpu_port)).unwrap();
294282
info.set_tpu(
295283
QUIC,
296284
public_tpu_addr.unwrap_or_else(|| SocketAddr::new(advertised_ip, tpu_port_quic)),
297285
)
298286
.unwrap();
299-
info.set_tpu_forwards(UDP, (advertised_ip, tpu_forwards_port))
300-
.unwrap();
301287
info.set_tpu_forwards(
302288
QUIC,
303289
public_tpu_forwards_addr
@@ -336,8 +322,6 @@ impl Node {
336322
alpenglow: Some(alpenglow),
337323
gossip: gossip_sockets.into_iter().collect(),
338324
tvu: tvu_sockets,
339-
tpu: tpu_sockets,
340-
tpu_forwards: tpu_forwards_sockets,
341325
tpu_vote: tpu_vote_sockets,
342326
broadcast,
343327
repair,
@@ -525,10 +509,7 @@ pub use multihoming::*;
525509

526510
#[cfg(test)]
527511
mod tests {
528-
use {
529-
super::*,
530-
crate::contact_info::Protocol::{QUIC, UDP},
531-
};
512+
use {super::*, crate::contact_info::Protocol::QUIC};
532513

533514
/// Regression test for fix where tpu_forwards_quic was incorrectly
534515
/// using tpu_forwards_port (UDP) instead of tpu_forwards_quic_port (QUIC)
@@ -538,7 +519,6 @@ mod tests {
538519
let node = Node::new_localhost_with_pubkey(&pubkey);
539520

540521
let tpu_forwards_quic = node.info.tpu_forwards(QUIC).unwrap();
541-
let tpu_forwards_udp = node.info.tpu_forwards(UDP).unwrap();
542522

543523
let actual_quic_port = node.sockets.tpu_forwards_quic[0]
544524
.local_addr()
@@ -550,11 +530,5 @@ mod tests {
550530
actual_quic_port,
551531
"TPU forwards QUIC advertised port should match actual bound QUIC socket"
552532
);
553-
554-
assert_ne!(
555-
tpu_forwards_quic.port(),
556-
tpu_forwards_udp.port(),
557-
"TPU forwards QUIC and UDP should use different ports"
558-
);
559533
}
560534
}

rpc/src/rpc.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3661,15 +3661,11 @@ pub mod rpc_full {
36613661
tvu: contact_info
36623662
.tvu(Protocol::UDP)
36633663
.filter(|addr| socket_addr_space.check(addr)),
3664-
tpu: contact_info
3665-
.tpu(Protocol::UDP)
3666-
.filter(|addr| socket_addr_space.check(addr)),
3664+
tpu: None,
36673665
tpu_quic: contact_info
36683666
.tpu(Protocol::QUIC)
36693667
.filter(|addr| socket_addr_space.check(addr)),
3670-
tpu_forwards: contact_info
3671-
.tpu_forwards(Protocol::UDP)
3672-
.filter(|addr| socket_addr_space.check(addr)),
3668+
tpu_forwards: None,
36733669
tpu_forwards_quic: contact_info
36743670
.tpu_forwards(Protocol::QUIC)
36753671
.filter(|addr| socket_addr_space.check(addr)),
@@ -5179,9 +5175,9 @@ pub mod tests {
51795175
"gossip": "127.0.0.1:8000",
51805176
"shredVersion": 0u16,
51815177
"tvu": "127.0.0.1:8001",
5182-
"tpu": "127.0.0.1:8003",
5178+
"tpu": null,
51835179
"tpuQuic": "127.0.0.1:8009",
5184-
"tpuForwards": "127.0.0.1:8004",
5180+
"tpuForwards": null,
51855181
"tpuForwardsQuic": "127.0.0.1:8010",
51865182
"tpuVote": "127.0.0.1:8005",
51875183
"serveRepair": "127.0.0.1:8008",
@@ -5194,9 +5190,9 @@ pub mod tests {
51945190
"gossip": "127.0.0.1:1235",
51955191
"shredVersion": 0u16,
51965192
"tvu": "127.0.0.1:1236",
5197-
"tpu": "127.0.0.1:1234",
5193+
"tpu": null,
51985194
"tpuQuic": "127.0.0.1:1240",
5199-
"tpuForwards": "127.0.0.1:1239",
5195+
"tpuForwards": null,
52005196
"tpuForwardsQuic": "127.0.0.1:1245",
52015197
"tpuVote": "127.0.0.1:1241",
52025198
"serveRepair": "127.0.0.1:1242",

test-validator/src/lib.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,6 @@ pub struct TestValidator {
795795
preserve_ledger: bool,
796796
rpc_pubsub_url: String,
797797
rpc_url: String,
798-
tpu: SocketAddr,
799798
tpu_quic: SocketAddr,
800799
gossip: SocketAddr,
801800
validator: Option<Validator>,
@@ -1130,8 +1129,7 @@ impl TestValidator {
11301129
let vote_account_address = validator_vote_account.pubkey();
11311130
let rpc_url = format!("http://{}", node.info.rpc().unwrap());
11321131
let rpc_pubsub_url = format!("ws://{}/", node.info.rpc_pubsub().unwrap());
1133-
let tpu = node.info.tpu(Protocol::UDP).unwrap();
1134-
let tpu_quic = node.info.tpu(Protocol::QUIC).unwrap_or(tpu);
1132+
let tpu_quic = node.info.tpu(Protocol::QUIC).unwrap();
11351133
let gossip = node.info.gossip().unwrap();
11361134

11371135
{
@@ -1234,7 +1232,6 @@ impl TestValidator {
12341232
preserve_ledger,
12351233
rpc_pubsub_url,
12361234
rpc_url,
1237-
tpu,
12381235
tpu_quic,
12391236
gossip,
12401237
validator,
@@ -1366,11 +1363,6 @@ impl TestValidator {
13661363
panic!("Timeout waiting for program to become usable");
13671364
}
13681365

1369-
/// Return the validator's TPU address
1370-
pub fn tpu(&self) -> &SocketAddr {
1371-
&self.tpu
1372-
}
1373-
13741366
/// Return the validator's TPU QUIC address
13751367
pub fn tpu_quic(&self) -> &SocketAddr {
13761368
&self.tpu_quic

0 commit comments

Comments
 (0)