diff --git a/core/src/next_leader.rs b/core/src/next_leader.rs index 738e728dcc4a30..e0196fe081af7a 100644 --- a/core/src/next_leader.rs +++ b/core/src/next_leader.rs @@ -1,7 +1,10 @@ use { crate::banking_stage::LikeClusterInfo, itertools::Itertools, - solana_gossip::{cluster_info::ClusterInfo, contact_info::ContactInfo}, + solana_gossip::{ + cluster_info::ClusterInfo, + contact_info::{ContactInfo, Protocol}, + }, solana_poh::poh_recorder::PohRecorder, solana_sdk::{clock::FORWARD_TRANSACTIONS_TO_LEADER_AT_SLOT_OFFSET, pubkey::Pubkey}, std::{net::SocketAddr, sync::RwLock}, @@ -26,7 +29,7 @@ pub(crate) fn upcoming_leader_tpu_vote_sockets( .dedup() .filter_map(|leader_pubkey| { cluster_info - .lookup_contact_info(&leader_pubkey, ContactInfo::tpu_vote)? + .lookup_contact_info(&leader_pubkey, |node| node.tpu_vote(Protocol::UDP))? .ok() }) // dedup again since leaders could potentially share the same tpu vote socket @@ -38,7 +41,9 @@ pub(crate) fn next_leader_tpu_vote( cluster_info: &impl LikeClusterInfo, poh_recorder: &RwLock, ) -> Option<(Pubkey, SocketAddr)> { - next_leader(cluster_info, poh_recorder, ContactInfo::tpu_vote) + next_leader(cluster_info, poh_recorder, |node| { + node.tpu_vote(Protocol::UDP) + }) } pub(crate) fn next_leader( diff --git a/gossip/src/cluster_info.rs b/gossip/src/cluster_info.rs index 67a587825d5843..b8acabfabc9786 100644 --- a/gossip/src/cluster_info.rs +++ b/gossip/src/cluster_info.rs @@ -855,7 +855,7 @@ impl ClusterInfo { "-".to_string() }, self.addr_to_string(&ip_addr, &node.gossip().ok()), - self.addr_to_string(&ip_addr, &node.tpu_vote().ok()), + self.addr_to_string(&ip_addr, &node.tpu_vote(contact_info::Protocol::UDP).ok()), self.addr_to_string(&ip_addr, &node.tpu(contact_info::Protocol::UDP).ok()), self.addr_to_string(&ip_addr, &node.tpu_forwards(contact_info::Protocol::UDP).ok()), self.addr_to_string(&ip_addr, &node.tvu(contact_info::Protocol::UDP).ok()), diff --git a/gossip/src/contact_info.rs b/gossip/src/contact_info.rs index 4a39ae34a6cbd3..2d65b0147b8bce 100644 --- a/gossip/src/contact_info.rs +++ b/gossip/src/contact_info.rs @@ -34,10 +34,11 @@ const SOCKET_TAG_TPU_FORWARDS: u8 = 6; const SOCKET_TAG_TPU_FORWARDS_QUIC: u8 = 7; const SOCKET_TAG_TPU_QUIC: u8 = 8; const SOCKET_TAG_TPU_VOTE: u8 = 9; +const SOCKET_TAG_TPU_VOTE_QUIC: u8 = 12; const SOCKET_TAG_TVU: u8 = 10; const SOCKET_TAG_TVU_QUIC: u8 = 11; -const_assert_eq!(SOCKET_CACHE_SIZE, 12); -const SOCKET_CACHE_SIZE: usize = SOCKET_TAG_TVU_QUIC as usize + 1usize; +const_assert_eq!(SOCKET_CACHE_SIZE, 13); +const SOCKET_CACHE_SIZE: usize = SOCKET_TAG_TPU_VOTE_QUIC as usize + 1usize; #[derive(Debug, Error)] pub enum Error { @@ -240,7 +241,7 @@ impl ContactInfo { SOCKET_TAG_TPU_FORWARDS, SOCKET_TAG_TPU_FORWARDS_QUIC ); - get_socket!(tpu_vote, SOCKET_TAG_TPU_VOTE); + get_socket!(tpu_vote, SOCKET_TAG_TPU_VOTE, SOCKET_TAG_TPU_VOTE_QUIC); get_socket!(tvu, SOCKET_TAG_TVU, SOCKET_TAG_TVU_QUIC); set_socket!(set_gossip, SOCKET_TAG_GOSSIP); @@ -255,6 +256,7 @@ impl ContactInfo { SOCKET_TAG_TPU_FORWARDS_QUIC ); set_socket!(set_tpu_vote, SOCKET_TAG_TPU_VOTE); + set_socket!(set_tpu_vote_quic, SOCKET_TAG_TPU_VOTE_QUIC); set_socket!(set_tvu, SOCKET_TAG_TVU); set_socket!(set_tvu_quic, SOCKET_TAG_TVU_QUIC); @@ -700,7 +702,8 @@ mod tests { assert_matches!(ci.tpu(Protocol::UDP), Err(Error::InvalidPort(0))); assert_matches!(ci.tpu_forwards(Protocol::QUIC), Err(Error::InvalidPort(0))); assert_matches!(ci.tpu_forwards(Protocol::UDP), Err(Error::InvalidPort(0))); - assert_matches!(ci.tpu_vote(), Err(Error::InvalidPort(0))); + assert_matches!(ci.tpu_vote(Protocol::UDP), Err(Error::InvalidPort(0))); + assert_matches!(ci.tpu_vote(Protocol::QUIC), Err(Error::InvalidPort(0))); assert_matches!(ci.tvu(Protocol::QUIC), Err(Error::InvalidPort(0))); assert_matches!(ci.tvu(Protocol::UDP), Err(Error::InvalidPort(0))); } @@ -856,9 +859,13 @@ mod tests { sockets.get(&SOCKET_TAG_TPU_FORWARDS_QUIC) ); assert_eq!( - node.tpu_vote().ok().as_ref(), + node.tpu_vote(Protocol::UDP).ok().as_ref(), sockets.get(&SOCKET_TAG_TPU_VOTE) ); + assert_eq!( + node.tpu_vote(Protocol::QUIC).ok().as_ref(), + sockets.get(&SOCKET_TAG_TPU_VOTE_QUIC) + ); assert_eq!( node.tvu(Protocol::UDP).ok().as_ref(), sockets.get(&SOCKET_TAG_TVU) @@ -954,7 +961,10 @@ mod tests { old.tpu(Protocol::UDP).unwrap().port() + QUIC_PORT_OFFSET ) ); - assert_eq!(old.tpu_vote().unwrap(), node.tpu_vote().unwrap()); + assert_eq!( + old.tpu_vote().unwrap(), + node.tpu_vote(Protocol::UDP).unwrap() + ); assert_eq!( old.tvu(Protocol::QUIC).unwrap(), node.tvu(Protocol::QUIC).unwrap() diff --git a/gossip/src/legacy_contact_info.rs b/gossip/src/legacy_contact_info.rs index 0634799652e418..a0b341ffcbe083 100644 --- a/gossip/src/legacy_contact_info.rs +++ b/gossip/src/legacy_contact_info.rs @@ -199,7 +199,7 @@ impl TryFrom<&ContactInfo> for LegacyContactInfo { serve_repair_quic: unwrap_socket!(serve_repair, Protocol::QUIC), tpu: unwrap_socket!(tpu, Protocol::UDP), tpu_forwards: unwrap_socket!(tpu_forwards, Protocol::UDP), - tpu_vote: unwrap_socket!(tpu_vote), + tpu_vote: unwrap_socket!(tpu_vote, Protocol::UDP), rpc: unwrap_socket!(rpc), rpc_pubsub: unwrap_socket!(rpc_pubsub), serve_repair: unwrap_socket!(serve_repair, Protocol::UDP), diff --git a/rpc/src/rpc.rs b/rpc/src/rpc.rs index 3f0da1debfa5d8..e29257b3986f2e 100644 --- a/rpc/src/rpc.rs +++ b/rpc/src/rpc.rs @@ -3528,7 +3528,7 @@ pub mod rpc_full { .ok() .filter(|addr| socket_addr_space.check(addr)), tpu_vote: contact_info - .tpu_vote() + .tpu_vote(Protocol::UDP) .ok() .filter(|addr| socket_addr_space.check(addr)), serve_repair: contact_info diff --git a/validator/src/admin_rpc_service.rs b/validator/src/admin_rpc_service.rs index 45af1f26dfd183..c133ea444886de 100644 --- a/validator/src/admin_rpc_service.rs +++ b/validator/src/admin_rpc_service.rs @@ -108,7 +108,7 @@ impl From for AdminRpcContactInfo { serve_repair_quic: unwrap_socket!(serve_repair, Protocol::QUIC), tpu: unwrap_socket!(tpu, Protocol::UDP), tpu_forwards: unwrap_socket!(tpu_forwards, Protocol::UDP), - tpu_vote: unwrap_socket!(tpu_vote), + tpu_vote: unwrap_socket!(tpu_vote, Protocol::UDP), rpc: unwrap_socket!(rpc), rpc_pubsub: unwrap_socket!(rpc_pubsub), serve_repair: unwrap_socket!(serve_repair, Protocol::UDP), diff --git a/validator/src/bootstrap.rs b/validator/src/bootstrap.rs index ef1ddf348b151f..aeb036c4c4e2af 100644 --- a/validator/src/bootstrap.rs +++ b/validator/src/bootstrap.rs @@ -91,7 +91,7 @@ fn verify_reachable_ports( udp_sockets.extend(node.sockets.tpu_forwards.iter()); udp_sockets.extend(&node.sockets.tpu_forwards_quic); } - if verify_address(&node.info.tpu_vote().ok()) { + if verify_address(&node.info.tpu_vote(Protocol::UDP).ok()) { udp_sockets.extend(node.sockets.tpu_vote.iter()); } if verify_address(&node.info.tvu(Protocol::UDP).ok()) {