Skip to content

Commit

Permalink
remove solana-sdk from solana-streamer
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinheavey committed Nov 12, 2024
1 parent 2c819d0 commit 550f78f
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 32 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.

12 changes: 10 additions & 2 deletions streamer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,18 @@ 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-sdk = { workspace = true, optional = 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 @@ -47,7 +55,7 @@ solana-logger = { workspace = true }
solana-streamer = { path = ".", features = ["dev-context-only-utils"] }

[features]
dev-context-only-utils = []
dev-context-only-utils = ["dep:solana-sdk"]

[lib]
crate-type = ["lib"]
Expand Down
25 changes: 13 additions & 12 deletions streamer/src/nonblocking/quic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,18 @@ use {
rand::{thread_rng, Rng},
smallvec::SmallVec,
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_keypair::Keypair,
solana_time_utils as timing,
solana_transaction_metrics_tracker::signature_if_should_track_packet,
std::{
array,
Expand Down Expand Up @@ -1533,7 +1532,9 @@ pub mod test {
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_sdk::net::DEFAULT_TPU_COALESCE,
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
8 changes: 3 additions & 5 deletions streamer/src/nonblocking/testing_utilities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ use {
TokioRuntime, TransportConfig,
},
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},
solana_sdk::net::DEFAULT_TPU_COALESCE,
solana_signer::keypair::Keypair,
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
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_pubkey::Pubkey,
solana_keypair::Keypair,
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 550f78f

Please sign in to comment.