Skip to content

Commit

Permalink
Add quic port for accepting transactions
Browse files Browse the repository at this point in the history
using quinn library

streamer: Sign TLS cert with validator identity key

Handle multiple incoming chunks
  • Loading branch information
sakridge committed Feb 4, 2022
1 parent 93789ca commit b50c617
Show file tree
Hide file tree
Showing 10 changed files with 660 additions and 26 deletions.
174 changes: 169 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions core/src/tpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use {
cost_model::CostModel,
vote_sender_types::{ReplayVoteReceiver, ReplayVoteSender},
},
solana_sdk::signature::Keypair,
std::{
net::UdpSocket,
sync::{atomic::AtomicBool, Arc, Mutex, RwLock},
Expand All @@ -40,6 +41,7 @@ pub struct TpuSockets {
pub transaction_forwards: Vec<UdpSocket>,
pub vote: Vec<UdpSocket>,
pub broadcast: Vec<UdpSocket>,
pub transactions_quic: UdpSocket,
}

pub struct Tpu {
Expand All @@ -49,6 +51,7 @@ pub struct Tpu {
banking_stage: BankingStage,
cluster_info_vote_listener: ClusterInfoVoteListener,
broadcast_stage: BroadcastStage,
tpu_quic_t: thread::JoinHandle<()>,
}

impl Tpu {
Expand All @@ -75,12 +78,14 @@ impl Tpu {
tpu_coalesce_ms: u64,
cluster_confirmed_slot_sender: GossipDuplicateConfirmedSlotsSender,
cost_model: &Arc<RwLock<CostModel>>,
keypair: &Keypair,
) -> Self {
let TpuSockets {
transactions: transactions_sockets,
transaction_forwards: tpu_forwards_sockets,
vote: tpu_vote_sockets,
broadcast: broadcast_sockets,
transactions_quic: transactions_quic_sockets,
} = sockets;

let (packet_sender, packet_receiver) = unbounded();
Expand All @@ -97,6 +102,15 @@ impl Tpu {
);
let (verified_sender, verified_receiver) = unbounded();

let tpu_quic_t = solana_streamer::quic::spawn_server(
transactions_quic_sockets,
keypair,
cluster_info.my_contact_info().tpu.ip(),
packet_sender,
exit.clone(),
)
.unwrap();

let sigverify_stage = {
let verifier = TransactionSigVerifier::default();
SigVerifyStage::new(packet_receiver, verified_sender, verifier)
Expand Down Expand Up @@ -160,6 +174,7 @@ impl Tpu {
banking_stage,
cluster_info_vote_listener,
broadcast_stage,
tpu_quic_t,
}
}

Expand All @@ -171,6 +186,7 @@ impl Tpu {
self.cluster_info_vote_listener.join(),
self.banking_stage.join(),
];
self.tpu_quic_t.join()?;
let broadcast_result = self.broadcast_stage.join();
for result in results {
result?;
Expand Down
9 changes: 7 additions & 2 deletions core/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -531,8 +531,11 @@ impl Validator {
}
}

let mut cluster_info =
ClusterInfo::new(node.info.clone(), identity_keypair, socket_addr_space);
let mut cluster_info = ClusterInfo::new(
node.info.clone(),
identity_keypair.clone(),
socket_addr_space,
);
cluster_info.set_contact_debug_interval(config.contact_debug_interval);
cluster_info.set_entrypoints(cluster_entrypoints);
cluster_info.restore_contact_info(ledger_path, config.contact_save_interval);
Expand Down Expand Up @@ -877,6 +880,7 @@ impl Validator {
transaction_forwards: node.sockets.tpu_forwards,
vote: node.sockets.tpu_vote,
broadcast: node.sockets.broadcast,
transactions_quic: node.sockets.tpu_quic,
},
&rpc_subscriptions,
transaction_status_sender,
Expand All @@ -894,6 +898,7 @@ impl Validator {
config.tpu_coalesce_ms,
cluster_confirmed_slot_sender,
&cost_model,
&identity_keypair,
);

datapoint_info!("validator-new", ("id", id.to_string(), String));
Expand Down
Loading

0 comments on commit b50c617

Please sign in to comment.