Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion core/src/repair/serve_repair.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1950,7 +1950,6 @@ mod tests {
);
nxt.set_gossip((Ipv4Addr::LOCALHOST, 1234)).unwrap();
nxt.set_tvu(UDP, (Ipv4Addr::LOCALHOST, 1235)).unwrap();
nxt.set_tvu(QUIC, (Ipv4Addr::LOCALHOST, 1236)).unwrap();
nxt.set_rpc((Ipv4Addr::LOCALHOST, 1241)).unwrap();
nxt.set_rpc_pubsub((Ipv4Addr::LOCALHOST, 1242)).unwrap();
nxt.set_serve_repair(UDP, serve_repair_addr2).unwrap();
Expand Down
13 changes: 4 additions & 9 deletions dos/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,7 @@ pub mod test {
allow_private_addr: false,
num_gen_threads: 1,
transaction_params: TransactionParams::default(),
tpu_use_quic: false,
tpu_use_quic: true,
send_batch_size: TEST_SEND_BATCH_SIZE,
},
);
Expand Down Expand Up @@ -1017,7 +1017,7 @@ pub mod test {
transaction_type: None,
num_instructions: None,
},
tpu_use_quic: false,
tpu_use_quic: true,
send_batch_size: TEST_SEND_BATCH_SIZE,
},
);
Expand Down Expand Up @@ -1045,7 +1045,7 @@ pub mod test {
transaction_type: None,
num_instructions: None,
},
tpu_use_quic: false,
tpu_use_quic: true,
send_batch_size: TEST_SEND_BATCH_SIZE,
},
);
Expand Down Expand Up @@ -1073,7 +1073,7 @@ pub mod test {
transaction_type: None,
num_instructions: None,
},
tpu_use_quic: false,
tpu_use_quic: true,
send_batch_size: TEST_SEND_BATCH_SIZE,
},
);
Expand Down Expand Up @@ -1247,11 +1247,6 @@ pub mod test {
);
}

#[test]
fn test_dos_with_blockhash_and_payer() {
run_dos_with_blockhash_and_payer(/*tpu_use_quic*/ false)
}

#[test]
fn test_dos_with_blockhash_and_payer_and_quic() {
run_dos_with_blockhash_and_payer(/*tpu_use_quic*/ true)
Expand Down
12 changes: 5 additions & 7 deletions gossip/src/cluster_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -596,10 +596,10 @@ impl ClusterInfo {
},
self.addr_to_string(&ip_addr, &node.gossip()),
self.addr_to_string(&ip_addr, &node.tpu_vote(contact_info::Protocol::UDP)),
self.addr_to_string(&ip_addr, &node.tpu(contact_info::Protocol::UDP)),
self.addr_to_string(&ip_addr, &node.tpu(contact_info::Protocol::QUIC)),
self.addr_to_string(
&ip_addr,
&node.tpu_forwards(contact_info::Protocol::UDP)
&node.tpu_forwards(contact_info::Protocol::QUIC)
),
self.addr_to_string(&ip_addr, &node.tvu(contact_info::Protocol::UDP)),
self.addr_to_string(
Expand Down Expand Up @@ -1144,7 +1144,7 @@ impl ClusterInfo {

fn is_spy_node(node: &ContactInfo, socket_addr_space: &SocketAddrSpace) -> bool {
![
node.tpu(contact_info::Protocol::UDP),
node.tpu(contact_info::Protocol::QUIC),
node.gossip(),
node.tvu(contact_info::Protocol::UDP),
]
Expand All @@ -1163,7 +1163,7 @@ impl ClusterInfo {
.get_nodes_contact_info()
.filter(|node| {
node.pubkey() != &self_pubkey
&& self.check_socket_addr_space(&node.tpu(contact_info::Protocol::UDP))
&& self.check_socket_addr_space(&node.tpu(contact_info::Protocol::QUIC))
})
.cloned()
.collect()
Expand Down Expand Up @@ -2366,8 +2366,6 @@ pub struct Sockets {
pub gossip: Arc<[UdpSocket]>,
pub ip_echo: Option<TcpListener>,
pub tvu: Vec<UdpSocket>,
pub tpu: Vec<UdpSocket>,
pub tpu_forwards: Vec<UdpSocket>,
pub tpu_vote: Vec<UdpSocket>,
pub broadcast: Vec<UdpSocket>,
// Socket sending out local repair requests,
Expand Down Expand Up @@ -2866,7 +2864,7 @@ mod tests {
}
check_sockets(&node.sockets.gossip, ip, range);
check_sockets(&node.sockets.tvu, ip, range);
check_sockets(&node.sockets.tpu, ip, range);
check_sockets(&node.sockets.tpu_quic, ip, range);
}

#[test]
Expand Down
18 changes: 2 additions & 16 deletions gossip/src/contact_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ const SOCKET_TAG_RPC: u8 = 2;
const SOCKET_TAG_RPC_PUBSUB: u8 = 3;
const SOCKET_TAG_SERVE_REPAIR: u8 = 4;
const SOCKET_TAG_SERVE_REPAIR_QUIC: u8 = 1;
const SOCKET_TAG_TPU: u8 = 5;
const SOCKET_TAG_TPU_FORWARDS: u8 = 6;
const SOCKET_TAG_TPU: u8 = 5; // not in use
const SOCKET_TAG_TPU_FORWARDS: u8 = 6; // not in use
const SOCKET_TAG_TPU_FORWARDS_QUIC: u8 = 7;
const SOCKET_TAG_TPU_QUIC: u8 = 8;
const SOCKET_TAG_TPU_VOTE: u8 = 9;
Expand Down Expand Up @@ -442,10 +442,7 @@ impl ContactInfo {
let mut node = Self::new(*pubkey, wallclock, /*shred_version:*/ 0u16);
node.set_gossip((Ipv4Addr::LOCALHOST, 8000)).unwrap();
node.set_tvu(UDP, (Ipv4Addr::LOCALHOST, 8001)).unwrap();
node.set_tpu(UDP, (Ipv4Addr::LOCALHOST, 8003)).unwrap();
node.set_tpu(QUIC, (Ipv4Addr::LOCALHOST, 8009)).unwrap();
node.set_tpu_forwards(UDP, (Ipv4Addr::LOCALHOST, 8004))
.unwrap();
node.set_tpu_forwards(QUIC, (Ipv4Addr::LOCALHOST, 8010))
.unwrap();
node.set_tpu_vote(UDP, (Ipv4Addr::LOCALHOST, 8005)).unwrap();
Expand Down Expand Up @@ -474,10 +471,7 @@ impl ContactInfo {
let (addr, port) = (socket.ip(), socket.port());
node.set_gossip((addr, port + 1)).unwrap();
node.set_tvu(UDP, (addr, port + 2)).unwrap();
node.set_tvu(QUIC, (addr, port + 3)).unwrap();
node.set_tpu(UDP, (addr, port)).unwrap();
node.set_tpu(QUIC, (addr, port + 6)).unwrap();
node.set_tpu_forwards(UDP, (addr, port + 5)).unwrap();
node.set_tpu_forwards(QUIC, (addr, port + 11)).unwrap();
node.set_tpu_vote(UDP, (addr, port + 7)).unwrap();
node.set_tpu_vote(QUIC, (addr, port + 9)).unwrap();
Expand Down Expand Up @@ -903,18 +897,10 @@ mod tests {
node.serve_repair(Protocol::QUIC).as_ref(),
sockets.get(&SOCKET_TAG_SERVE_REPAIR_QUIC)
);
assert_eq!(
node.tpu(Protocol::UDP).as_ref(),
sockets.get(&SOCKET_TAG_TPU)
);
assert_eq!(
node.tpu(Protocol::QUIC).as_ref(),
sockets.get(&SOCKET_TAG_TPU_QUIC)
);
assert_eq!(
node.tpu_forwards(Protocol::UDP).as_ref(),
sockets.get(&SOCKET_TAG_TPU_FORWARDS)
);
assert_eq!(
node.tpu_forwards(Protocol::QUIC).as_ref(),
sockets.get(&SOCKET_TAG_TPU_FORWARDS_QUIC)
Expand Down
4 changes: 2 additions & 2 deletions gossip/src/crds_gossip_pull.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1571,7 +1571,7 @@ pub(crate) mod tests {
};
{
let caller: CrdsValue = CrdsValue::new(CrdsData::from(&node), &keypair);
assert_eq!(get_max_bloom_filter_bytes(&caller), 1175);
assert_eq!(get_max_bloom_filter_bytes(&caller), 1184);
verify_get_max_bloom_filter_bytes(&mut rng, &caller, num_items);
}
let node = {
Expand All @@ -1583,7 +1583,7 @@ pub(crate) mod tests {
};
{
let caller = CrdsValue::new(CrdsData::from(&node), &keypair);
assert_eq!(get_max_bloom_filter_bytes(&caller), 1155);
assert_eq!(get_max_bloom_filter_bytes(&caller), 1175);
verify_get_max_bloom_filter_bytes(&mut rng, &caller, num_items);
}
}
Expand Down
28 changes: 1 addition & 27 deletions gossip/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,6 @@ impl Node {
);
let tvu_addresses = Self::get_socket_addrs(&tvu_sockets);

let (tpu_port, tpu_socket) =
bind_in_range_with_config(bind_ip_addr, port_range, socket_config)
.expect("tpu_socket primary bind");
let tpu_sockets =
bind_more_with_config(tpu_socket, 32, socket_config).expect("tpu_sockets multi_bind");

let (tpu_port_quic, tpu_quic) =
bind_in_range_with_config(bind_ip_addr, port_range, socket_config)
.expect("tpu_quic primary bind");
Expand All @@ -147,11 +141,6 @@ impl Node {
);
let tpu_quic_addresses = Self::get_socket_addrs(&tpu_quic);

let (tpu_forwards_port, tpu_forwards_socket) =
bind_in_range_with_config(bind_ip_addr, port_range, socket_config)
.expect("tpu_forwards primary bind");
let tpu_forwards_sockets = bind_more_with_config(tpu_forwards_socket, 8, socket_config)
.expect("tpu_forwards multi_bind");
let (tpu_forwards_quic_port, tpu_forwards_quic) =
bind_in_range_with_config(bind_ip_addr, port_range, socket_config)
.expect("tpu_forwards_quic primary bind");
Expand Down Expand Up @@ -290,14 +279,11 @@ impl Node {
public_tvu_addr.unwrap_or_else(|| SocketAddr::new(advertised_ip, tvu_port)),
)
.unwrap();
info.set_tpu(UDP, (advertised_ip, tpu_port)).unwrap();
info.set_tpu(
QUIC,
public_tpu_addr.unwrap_or_else(|| SocketAddr::new(advertised_ip, tpu_port_quic)),
)
.unwrap();
info.set_tpu_forwards(UDP, (advertised_ip, tpu_forwards_port))
.unwrap();
info.set_tpu_forwards(
QUIC,
public_tpu_forwards_addr
Expand Down Expand Up @@ -336,8 +322,6 @@ impl Node {
alpenglow: Some(alpenglow),
gossip: gossip_sockets.into_iter().collect(),
tvu: tvu_sockets,
tpu: tpu_sockets,
tpu_forwards: tpu_forwards_sockets,
tpu_vote: tpu_vote_sockets,
broadcast,
repair,
Expand Down Expand Up @@ -525,10 +509,7 @@ pub use multihoming::*;

#[cfg(test)]
mod tests {
use {
super::*,
crate::contact_info::Protocol::{QUIC, UDP},
};
use {super::*, crate::contact_info::Protocol::QUIC};

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

let tpu_forwards_quic = node.info.tpu_forwards(QUIC).unwrap();
let tpu_forwards_udp = node.info.tpu_forwards(UDP).unwrap();

let actual_quic_port = node.sockets.tpu_forwards_quic[0]
.local_addr()
Expand All @@ -550,11 +530,5 @@ mod tests {
actual_quic_port,
"TPU forwards QUIC advertised port should match actual bound QUIC socket"
);

assert_ne!(
tpu_forwards_quic.port(),
tpu_forwards_udp.port(),
"TPU forwards QUIC and UDP should use different ports"
);
}
}
16 changes: 6 additions & 10 deletions rpc/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3661,15 +3661,11 @@ pub mod rpc_full {
tvu: contact_info
.tvu(Protocol::UDP)
.filter(|addr| socket_addr_space.check(addr)),
tpu: contact_info
.tpu(Protocol::UDP)
.filter(|addr| socket_addr_space.check(addr)),
tpu: None,
tpu_quic: contact_info
.tpu(Protocol::QUIC)
.filter(|addr| socket_addr_space.check(addr)),
tpu_forwards: contact_info
.tpu_forwards(Protocol::UDP)
.filter(|addr| socket_addr_space.check(addr)),
tpu_forwards: None,
tpu_forwards_quic: contact_info
.tpu_forwards(Protocol::QUIC)
.filter(|addr| socket_addr_space.check(addr)),
Expand Down Expand Up @@ -5179,9 +5175,9 @@ pub mod tests {
"gossip": "127.0.0.1:8000",
"shredVersion": 0u16,
"tvu": "127.0.0.1:8001",
"tpu": "127.0.0.1:8003",
"tpu": null,
"tpuQuic": "127.0.0.1:8009",
"tpuForwards": "127.0.0.1:8004",
"tpuForwards": null,
"tpuForwardsQuic": "127.0.0.1:8010",
"tpuVote": "127.0.0.1:8005",
"serveRepair": "127.0.0.1:8008",
Expand All @@ -5194,9 +5190,9 @@ pub mod tests {
"gossip": "127.0.0.1:1235",
"shredVersion": 0u16,
"tvu": "127.0.0.1:1236",
"tpu": "127.0.0.1:1234",
"tpu": null,
"tpuQuic": "127.0.0.1:1240",
"tpuForwards": "127.0.0.1:1239",
"tpuForwards": null,
"tpuForwardsQuic": "127.0.0.1:1245",
"tpuVote": "127.0.0.1:1241",
"serveRepair": "127.0.0.1:1242",
Expand Down
10 changes: 1 addition & 9 deletions test-validator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,6 @@ pub struct TestValidator {
preserve_ledger: bool,
rpc_pubsub_url: String,
rpc_url: String,
tpu: SocketAddr,
tpu_quic: SocketAddr,
gossip: SocketAddr,
validator: Option<Validator>,
Expand Down Expand Up @@ -1130,8 +1129,7 @@ impl TestValidator {
let vote_account_address = validator_vote_account.pubkey();
let rpc_url = format!("http://{}", node.info.rpc().unwrap());
let rpc_pubsub_url = format!("ws://{}/", node.info.rpc_pubsub().unwrap());
let tpu = node.info.tpu(Protocol::UDP).unwrap();
let tpu_quic = node.info.tpu(Protocol::QUIC).unwrap_or(tpu);
let tpu_quic = node.info.tpu(Protocol::QUIC).unwrap();
let gossip = node.info.gossip().unwrap();

{
Expand Down Expand Up @@ -1234,7 +1232,6 @@ impl TestValidator {
preserve_ledger,
rpc_pubsub_url,
rpc_url,
tpu,
tpu_quic,
gossip,
validator,
Expand Down Expand Up @@ -1366,11 +1363,6 @@ impl TestValidator {
panic!("Timeout waiting for program to become usable");
}

/// Return the validator's TPU address
pub fn tpu(&self) -> &SocketAddr {
&self.tpu
}

/// Return the validator's TPU QUIC address
pub fn tpu_quic(&self) -> &SocketAddr {
&self.tpu_quic
Expand Down