Skip to content

Commit

Permalink
remove solana-sdk from solana-streamer (#3445)
Browse files Browse the repository at this point in the history
* remove solana-sdk from solana-streamer

* update import in tests

* fmt

* clean up dev deps

* fix import
  • Loading branch information
kevinheavey authored Nov 15, 2024
1 parent dffcdb4 commit e835942
Show file tree
Hide file tree
Showing 11 changed files with 73 additions and 37 deletions.
8 changes: 8 additions & 0 deletions Cargo.lock

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

9 changes: 8 additions & 1 deletion programs/sbf/Cargo.lock

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

10 changes: 9 additions & 1 deletion streamer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand All @@ -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]
Expand Down
37 changes: 20 additions & 17 deletions streamer/src/nonblocking/quic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
};
Expand Down
2 changes: 1 addition & 1 deletion streamer/src/nonblocking/sendmmsg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
12 changes: 6 additions & 6 deletions streamer/src/nonblocking/testing_utilities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand All @@ -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},
Expand Down
2 changes: 1 addition & 1 deletion streamer/src/packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<usize> {
Expand Down
16 changes: 11 additions & 5 deletions streamer/src/quic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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<rustls::crypto::CryptoProvider>);
Expand Down Expand Up @@ -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);
}
}
4 changes: 2 additions & 2 deletions streamer/src/sendmmsg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use {
},
};
use {
solana_sdk::transport::TransportError,
solana_transaction_error::TransportError,
std::{
borrow::Borrow,
io,
Expand Down Expand Up @@ -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},
Expand Down
4 changes: 3 additions & 1 deletion streamer/src/streamer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 4 additions & 2 deletions streamer/src/tls_certificates.rs
Original file line number Diff line number Diff line change
@@ -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},
};

Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit e835942

Please sign in to comment.