Skip to content

Commit

Permalink
Extract quic-definitions crate (solana-labs#3119)
Browse files Browse the repository at this point in the history
* extract quic-definitions crate

* put quic-definitions dep behind "full" feature of sdk

* use solana_packet crate directly

Co-authored-by: Jon C <[email protected]>

* use solana_packet crate directly

Co-authored-by: Jon C <[email protected]>

---------

Co-authored-by: Jon C <[email protected]>
  • Loading branch information
kevinheavey and joncinque authored Nov 12, 2024
1 parent d2e7488 commit 2c819d0
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 6 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.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ members = [
"sdk/program-option",
"sdk/program-pack",
"sdk/pubkey",
"sdk/quic-definitions",
"sdk/rent",
"sdk/reserved-account-keys",
"sdk/sanitize",
Expand Down Expand Up @@ -492,6 +493,7 @@ solana-program-test = { path = "program-test", version = "=2.2.0" }
solana-pubkey = { path = "sdk/pubkey", version = "=2.2.0", default-features = false }
solana-pubsub-client = { path = "pubsub-client", version = "=2.2.0" }
solana-quic-client = { path = "quic-client", version = "=2.2.0" }
solana-quic-definitions = { path = "sdk/quic-definitions", version = "=2.2.0" }
solana-rayon-threadlimit = { path = "rayon-threadlimit", version = "=2.2.0" }
solana-remote-wallet = { path = "remote-wallet", version = "=2.2.0", default-features = false }
solana-rent = { path = "sdk/rent", version = "=2.2.0", default-features = false }
Expand Down
8 changes: 8 additions & 0 deletions programs/sbf/Cargo.lock

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

2 changes: 2 additions & 0 deletions sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ full = [
"dep:solana-keypair",
"dep:solana-precompile-error",
"dep:solana-presigner",
"dep:solana-quic-definitions",
"dep:solana-seed-derivable",
"dep:solana-seed-phrase",
"dep:solana-signer",
Expand Down Expand Up @@ -116,6 +117,7 @@ solana-presigner = { workspace = true, optional = true }
solana-program = { workspace = true }
solana-program-memory = { workspace = true }
solana-pubkey = { workspace = true, default-features = false, features = ["std"] }
solana-quic-definitions = { workspace = true, optional = true }
solana-reserved-account-keys = { workspace = true }
solana-reward-info = { workspace = true, features = ["serde"] }
solana-sanitize = { workspace = true }
Expand Down
19 changes: 19 additions & 0 deletions sdk/quic-definitions/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
name = "solana-quic-definitions"
description = "Definitions related to Solana over QUIC."
documentation = "https://docs.rs/solana-quic-definitions"
version = { workspace = true }
authors = { workspace = true }
repository = { workspace = true }
homepage = { workspace = true }
license = { workspace = true }
edition = { workspace = true }

[dependencies]
solana-keypair = { workspace = true }

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

[lints]
workspace = true
15 changes: 10 additions & 5 deletions sdk/src/quic.rs → sdk/quic-definitions/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![cfg(feature = "full")]
//! Definitions related to Solana over QUIC.
use {crate::signer::keypair::Keypair, std::time::Duration};
use {solana_keypair::Keypair, std::time::Duration};

pub const QUIC_PORT_OFFSET: u16 = 6;
// Empirically found max number of concurrent streams
Expand All @@ -26,15 +25,21 @@ pub const QUIC_KEEP_ALIVE: Duration = Duration::from_secs(1);
pub const QUIC_CONNECTION_HANDSHAKE_TIMEOUT: Duration = Duration::from_secs(60);

/// The receive window for QUIC connection from unstaked nodes is
/// set to this ratio times [`solana_sdk::packet::PACKET_DATA_SIZE`]
/// set to this ratio times [`solana_packet::PACKET_DATA_SIZE`]
///
/// [`solana_packet::PACKET_DATA_SIZE`]: https://docs.rs/solana-packet/latest/solana_packet/constant.PACKET_DATA_SIZE.html
pub const QUIC_UNSTAKED_RECEIVE_WINDOW_RATIO: u64 = 128;

/// The receive window for QUIC connection from minimum staked nodes is
/// set to this ratio times [`solana_sdk::packet::PACKET_DATA_SIZE`]
/// set to this ratio times [`solana_packet::PACKET_DATA_SIZE`]
///
/// [`solana_packet::PACKET_DATA_SIZE`]: https://docs.rs/solana-packet/latest/solana_packet/constant.PACKET_DATA_SIZE.html
pub const QUIC_MIN_STAKED_RECEIVE_WINDOW_RATIO: u64 = 128;

/// The receive window for QUIC connection from maximum staked nodes is
/// set to this ratio times [`solana_sdk::packet::PACKET_DATA_SIZE`]
/// set to this ratio times [`solana_packet::PACKET_DATA_SIZE`]
///
/// [`solana_packet::PACKET_DATA_SIZE`]: https://docs.rs/solana-packet/latest/solana_packet/constant.PACKET_DATA_SIZE.html
pub const QUIC_MAX_STAKED_RECEIVE_WINDOW_RATIO: u64 = 512;

pub trait NotifyKeyUpdate {
Expand Down
4 changes: 3 additions & 1 deletion sdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ pub mod poh_config;
pub mod precompiles;
pub mod program_utils;
pub mod pubkey;
pub mod quic;
pub mod rent_collector;
pub mod rent_debits;
#[deprecated(since = "2.2.0", note = "Use `solana-reward-info` crate instead")]
Expand Down Expand Up @@ -149,6 +148,9 @@ pub use solana_program_memory as program_memory;
/// ```
pub use solana_pubkey::pubkey;
#[cfg(feature = "full")]
#[deprecated(since = "2.2.0", note = "Use `solana-quic-definitions` crate instead")]
pub use solana_quic_definitions as quic;
#[cfg(feature = "full")]
#[deprecated(
since = "2.2.0",
note = "Use `solana-reserved-account-keys` crate instead"
Expand Down

0 comments on commit 2c819d0

Please sign in to comment.