diff --git a/Cargo.lock b/Cargo.lock index 7d015ada9184f0..6e93d5b66b56c2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8717,12 +8717,20 @@ dependencies = [ "rustls 0.23.16", "smallvec", "socket2 0.5.7", + "solana-keypair", "solana-logger", "solana-measure", "solana-metrics", + "solana-packet", "solana-perf", + "solana-pubkey", + "solana-quic-definitions", "solana-sdk", + "solana-signature", + "solana-signer", "solana-streamer", + "solana-time-utils", + "solana-transaction-error", "solana-transaction-metrics-tracker", "thiserror 1.0.69", "tokio", diff --git a/programs/sbf/Cargo.lock b/programs/sbf/Cargo.lock index ba57249ce81a99..31bf76e5485cf7 100644 --- a/programs/sbf/Cargo.lock +++ b/programs/sbf/Cargo.lock @@ -7388,10 +7388,17 @@ dependencies = [ "rustls 0.23.16", "smallvec", "socket2 0.5.7", + "solana-keypair", "solana-measure", "solana-metrics", + "solana-packet", "solana-perf", - "solana-sdk", + "solana-pubkey", + "solana-quic-definitions", + "solana-signature", + "solana-signer", + "solana-time-utils", + "solana-transaction-error", "solana-transaction-metrics-tracker", "thiserror 1.0.69", "tokio", diff --git a/streamer/Cargo.toml b/streamer/Cargo.toml index f44e99771c0783..3c2e62890d9b5a 100644 --- a/streamer/Cargo.toml +++ b/streamer/Cargo.toml @@ -31,10 +31,17 @@ rand = { workspace = true } rustls = { workspace = true } smallvec = { workspace = true } socket2 = { workspace = true } +solana-keypair = { workspace = true } solana-measure = { workspace = true } solana-metrics = { workspace = true } +solana-packet = { workspace = true } solana-perf = { workspace = true } -solana-sdk = { workspace = true } +solana-pubkey = { workspace = true } +solana-quic-definitions = { workspace = true } +solana-signature = { workspace = true } +solana-signer = { workspace = true } +solana-time-utils = { workspace = true } +solana-transaction-error = { workspace = true } solana-transaction-metrics-tracker = { workspace = true } thiserror = { workspace = true } tokio = { workspace = true, features = ["full"] } @@ -44,6 +51,7 @@ x509-parser = { workspace = true } [dev-dependencies] assert_matches = { workspace = true } solana-logger = { workspace = true } +solana-sdk = { workspace = true } solana-streamer = { path = ".", features = ["dev-context-only-utils"] } [features] diff --git a/streamer/src/nonblocking/quic.rs b/streamer/src/nonblocking/quic.rs index acc04c11c768ce..2de8adc1babb08 100644 --- a/streamer/src/nonblocking/quic.rs +++ b/streamer/src/nonblocking/quic.rs @@ -23,20 +23,19 @@ use { quinn_proto::VarIntBoundsExceeded, rand::{thread_rng, Rng}, smallvec::SmallVec, + solana_keypair::Keypair, solana_measure::measure::Measure, + solana_packet::{Meta, PACKET_DATA_SIZE}, solana_perf::packet::{PacketBatch, PACKETS_PER_BATCH}, - solana_sdk::{ - packet::{Meta, PACKET_DATA_SIZE}, - pubkey::Pubkey, - quic::{ - QUIC_CONNECTION_HANDSHAKE_TIMEOUT, QUIC_MAX_STAKED_CONCURRENT_STREAMS, - QUIC_MAX_STAKED_RECEIVE_WINDOW_RATIO, QUIC_MAX_UNSTAKED_CONCURRENT_STREAMS, - QUIC_MIN_STAKED_CONCURRENT_STREAMS, QUIC_MIN_STAKED_RECEIVE_WINDOW_RATIO, - QUIC_TOTAL_STAKED_CONCURRENT_STREAMS, QUIC_UNSTAKED_RECEIVE_WINDOW_RATIO, - }, - signature::{Keypair, Signature}, - timing, + solana_pubkey::Pubkey, + solana_quic_definitions::{ + QUIC_CONNECTION_HANDSHAKE_TIMEOUT, QUIC_MAX_STAKED_CONCURRENT_STREAMS, + QUIC_MAX_STAKED_RECEIVE_WINDOW_RATIO, QUIC_MAX_UNSTAKED_CONCURRENT_STREAMS, + QUIC_MIN_STAKED_CONCURRENT_STREAMS, QUIC_MIN_STAKED_RECEIVE_WINDOW_RATIO, + QUIC_TOTAL_STAKED_CONCURRENT_STREAMS, QUIC_UNSTAKED_RECEIVE_WINDOW_RATIO, }, + solana_signature::Signature, + solana_time_utils as timing, solana_transaction_metrics_tracker::signature_if_should_track_packet, std::{ array, @@ -1522,18 +1521,22 @@ impl<'a> Future for EndpointAccept<'a> { pub mod test { use { super::*, - crate::nonblocking::{ - quic::compute_max_allowed_uni_streams, - testing_utilities::{ - get_client_config, make_client_endpoint, setup_quic_server, SpawnTestServerResult, - TestServerConfig, + crate::{ + nonblocking::{ + quic::compute_max_allowed_uni_streams, + testing_utilities::{ + get_client_config, make_client_endpoint, setup_quic_server, + SpawnTestServerResult, TestServerConfig, + }, }, + quic::DEFAULT_TPU_COALESCE, }, assert_matches::assert_matches, async_channel::unbounded as async_unbounded, crossbeam_channel::{unbounded, Receiver}, quinn::{ApplicationClose, ConnectionError}, - solana_sdk::{net::DEFAULT_TPU_COALESCE, signature::Keypair, signer::Signer}, + solana_keypair::Keypair, + solana_signer::Signer, std::collections::HashMap, tokio::time::sleep, }; diff --git a/streamer/src/nonblocking/sendmmsg.rs b/streamer/src/nonblocking/sendmmsg.rs index 15217b906eb5da..352651d1d61c90 100644 --- a/streamer/src/nonblocking/sendmmsg.rs +++ b/streamer/src/nonblocking/sendmmsg.rs @@ -61,7 +61,7 @@ mod tests { sendmmsg::SendPktsError, }, assert_matches::assert_matches, - solana_sdk::packet::PACKET_DATA_SIZE, + solana_packet::PACKET_DATA_SIZE, std::{ io::ErrorKind, net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr}, diff --git a/streamer/src/nonblocking/testing_utilities.rs b/streamer/src/nonblocking/testing_utilities.rs index e1a13c23fb2e69..aa484cbc511a5d 100644 --- a/streamer/src/nonblocking/testing_utilities.rs +++ b/streamer/src/nonblocking/testing_utilities.rs @@ -6,7 +6,10 @@ use { DEFAULT_WAIT_FOR_CHUNK_TIMEOUT, }, crate::{ - quic::{QuicServerParams, StreamerStats, MAX_STAKED_CONNECTIONS, MAX_UNSTAKED_CONNECTIONS}, + quic::{ + QuicServerParams, StreamerStats, DEFAULT_TPU_COALESCE, MAX_STAKED_CONNECTIONS, + MAX_UNSTAKED_CONNECTIONS, + }, streamer::StakedNodes, tls_certificates::new_dummy_x509_certificate, }, @@ -15,12 +18,9 @@ use { crypto::rustls::QuicClientConfig, ClientConfig, Connection, EndpointConfig, IdleTimeout, TokioRuntime, TransportConfig, }, + solana_keypair::Keypair, solana_perf::packet::PacketBatch, - solana_sdk::{ - net::DEFAULT_TPU_COALESCE, - quic::{QUIC_KEEP_ALIVE, QUIC_MAX_TIMEOUT}, - signer::keypair::Keypair, - }, + solana_quic_definitions::{QUIC_KEEP_ALIVE, QUIC_MAX_TIMEOUT}, std::{ net::{SocketAddr, UdpSocket}, sync::{atomic::AtomicBool, Arc, RwLock}, diff --git a/streamer/src/packet.rs b/streamer/src/packet.rs index fdab5eba14ffea..5b89c939eaf2fa 100644 --- a/streamer/src/packet.rs +++ b/streamer/src/packet.rs @@ -11,10 +11,10 @@ use { }, }; pub use { + solana_packet::{Meta, Packet, PACKET_DATA_SIZE}, solana_perf::packet::{ to_packet_batches, PacketBatch, PacketBatchRecycler, NUM_PACKETS, PACKETS_PER_BATCH, }, - solana_sdk::packet::{Meta, Packet, PACKET_DATA_SIZE}, }; pub fn recv_from(batch: &mut PacketBatch, socket: &UdpSocket, max_wait: Duration) -> Result { diff --git a/streamer/src/quic.rs b/streamer/src/quic.rs index 21f173475ebf7b..1eb94926809f4d 100644 --- a/streamer/src/quic.rs +++ b/streamer/src/quic.rs @@ -18,12 +18,11 @@ use { server::danger::ClientCertVerified, DistinguishedName, KeyLogFile, }, + solana_keypair::Keypair, + solana_packet::PACKET_DATA_SIZE, solana_perf::packet::PacketBatch, - solana_sdk::{ - net::DEFAULT_TPU_COALESCE, - packet::PACKET_DATA_SIZE, - quic::{NotifyKeyUpdate, QUIC_MAX_TIMEOUT, QUIC_MAX_UNSTAKED_CONCURRENT_STREAMS}, - signature::Keypair, + solana_quic_definitions::{ + NotifyKeyUpdate, QUIC_MAX_TIMEOUT, QUIC_MAX_UNSTAKED_CONCURRENT_STREAMS, }, std::{ net::UdpSocket, @@ -42,6 +41,8 @@ pub const MAX_UNSTAKED_CONNECTIONS: usize = 500; // This will be adjusted and parameterized in follow-on PRs. pub const DEFAULT_QUIC_ENDPOINTS: usize = 1; +// inlined to avoid solana-sdk dep +pub(crate) const DEFAULT_TPU_COALESCE: Duration = Duration::from_millis(5); #[derive(Debug)] pub struct SkipClientVerification(Arc); @@ -840,4 +841,9 @@ mod test { exit.store(true, Ordering::Relaxed); t.join().unwrap(); } + + #[test] + fn test_inline_tpu_coalesce() { + assert_eq!(DEFAULT_TPU_COALESCE, solana_sdk::net::DEFAULT_TPU_COALESCE); + } } diff --git a/streamer/src/sendmmsg.rs b/streamer/src/sendmmsg.rs index f3d3e8419def99..b1c8e58125a2a5 100644 --- a/streamer/src/sendmmsg.rs +++ b/streamer/src/sendmmsg.rs @@ -11,7 +11,7 @@ use { }, }; use { - solana_sdk::transport::TransportError, + solana_transaction_error::TransportError, std::{ borrow::Borrow, io, @@ -189,7 +189,7 @@ mod tests { sendmmsg::{batch_send, multi_target_send, SendPktsError}, }, assert_matches::assert_matches, - solana_sdk::packet::PACKET_DATA_SIZE, + solana_packet::PACKET_DATA_SIZE, std::{ io::ErrorKind, net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, UdpSocket}, diff --git a/streamer/src/streamer.rs b/streamer/src/streamer.rs index a79445c3b8e7ac..b4f1e54429fc07 100644 --- a/streamer/src/streamer.rs +++ b/streamer/src/streamer.rs @@ -10,7 +10,9 @@ use { crossbeam_channel::{Receiver, RecvTimeoutError, SendError, Sender}, histogram::Histogram, itertools::Itertools, - solana_sdk::{packet::Packet, pubkey::Pubkey, timing::timestamp}, + solana_packet::Packet, + solana_pubkey::Pubkey, + solana_time_utils::timestamp, std::{ cmp::Reverse, collections::HashMap, diff --git a/streamer/src/tls_certificates.rs b/streamer/src/tls_certificates.rs index fba1441de88a86..d48b8608a44b70 100644 --- a/streamer/src/tls_certificates.rs +++ b/streamer/src/tls_certificates.rs @@ -1,5 +1,7 @@ use { - solana_sdk::{pubkey::Pubkey, signature::Keypair, signer::Signer}, + solana_keypair::Keypair, + solana_pubkey::Pubkey, + solana_signer::Signer, x509_parser::{prelude::*, public_key::PublicKey}, }; @@ -113,7 +115,7 @@ pub fn get_pubkey_from_tls_certificate( #[cfg(test)] mod tests { - use {super::*, solana_sdk::signer::Signer}; + use {super::*, solana_signer::Signer}; #[test] fn test_generate_tls_certificate() {