From 3c83cadbdd0052943e95feb2978e6134f15d28c4 Mon Sep 17 00:00:00 2001 From: kevinheavey Date: Wed, 9 Oct 2024 15:17:19 +0400 Subject: [PATCH] extract quic-definitions crate --- Cargo.lock | 8 ++++++++ Cargo.toml | 2 ++ programs/sbf/Cargo.lock | 8 ++++++++ sdk/Cargo.toml | 1 + sdk/quic-definitions/Cargo.toml | 19 +++++++++++++++++++ .../quic.rs => quic-definitions/src/lib.rs} | 9 +++++++-- sdk/src/lib.rs | 4 +++- 7 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 sdk/quic-definitions/Cargo.toml rename sdk/{src/quic.rs => quic-definitions/src/lib.rs} (80%) diff --git a/Cargo.lock b/Cargo.lock index 4ed88fc594a000..fe73885b0221d2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7560,6 +7560,13 @@ dependencies = [ "tokio", ] +[[package]] +name = "solana-quic-definitions" +version = "2.1.0" +dependencies = [ + "solana-signer", +] + [[package]] name = "solana-rayon-threadlimit" version = "2.1.0" @@ -7937,6 +7944,7 @@ dependencies = [ "solana-program", "solana-program-memory", "solana-pubkey", + "solana-quic-definitions", "solana-sanitize", "solana-sdk", "solana-sdk-macro", diff --git a/Cargo.toml b/Cargo.toml index e0a23f79046a86..777fcbefa7a97a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -128,6 +128,7 @@ members = [ "sdk/program-option", "sdk/program-pack", "sdk/pubkey", + "sdk/quic-definitions", "sdk/rent", "sdk/sanitize", "sdk/seed-derivable", @@ -463,6 +464,7 @@ solana-program-test = { path = "program-test", version = "=2.1.0" } solana-pubkey = { path = "sdk/pubkey", version = "=2.1.0", default-features = false } solana-pubsub-client = { path = "pubsub-client", version = "=2.1.0" } solana-quic-client = { path = "quic-client", version = "=2.1.0" } +solana-quic-definitions = { path = "sdk/quic-definitions", version = "=2.1.0" } solana-rayon-threadlimit = { path = "rayon-threadlimit", version = "=2.1.0" } solana-remote-wallet = { path = "remote-wallet", version = "=2.1.0", default-features = false } solana-rent = { path = "sdk/rent", version = "=2.1.0", default-features = false } diff --git a/programs/sbf/Cargo.lock b/programs/sbf/Cargo.lock index b64315aa09b4d0..a00f8ef3d1d71b 100644 --- a/programs/sbf/Cargo.lock +++ b/programs/sbf/Cargo.lock @@ -5921,6 +5921,13 @@ dependencies = [ "tokio", ] +[[package]] +name = "solana-quic-definitions" +version = "2.1.0" +dependencies = [ + "solana-signer", +] + [[package]] name = "solana-rayon-threadlimit" version = "2.1.0" @@ -6697,6 +6704,7 @@ dependencies = [ "solana-program", "solana-program-memory", "solana-pubkey", + "solana-quic-definitions", "solana-sanitize", "solana-sdk-macro", "solana-secp256k1-recover", diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml index 424a2cdc5247bd..0a9474951a558b 100644 --- a/sdk/Cargo.toml +++ b/sdk/Cargo.toml @@ -106,6 +106,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 } solana-sanitize = { workspace = true } solana-sdk-macro = { workspace = true } solana-secp256k1-recover = { workspace = true } diff --git a/sdk/quic-definitions/Cargo.toml b/sdk/quic-definitions/Cargo.toml new file mode 100644 index 00000000000000..126c12f274094f --- /dev/null +++ b/sdk/quic-definitions/Cargo.toml @@ -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-signer = { workspace = true, features = ["keypair"] } + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[lints] +workspace = true diff --git a/sdk/src/quic.rs b/sdk/quic-definitions/src/lib.rs similarity index 80% rename from sdk/src/quic.rs rename to sdk/quic-definitions/src/lib.rs index 6e9e0a656c3396..5d5de87cfdc83d 100644 --- a/sdk/src/quic.rs +++ b/sdk/quic-definitions/src/lib.rs @@ -1,6 +1,5 @@ -#![cfg(feature = "full")] //! Definitions related to Solana over QUIC. -use {crate::signer::keypair::Keypair, std::time::Duration}; +use {solana_signer::keypair::Keypair, std::time::Duration}; pub const QUIC_PORT_OFFSET: u16 = 6; // Empirically found max number of concurrent streams @@ -27,14 +26,20 @@ 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`] +/// +/// [`solana_sdk::packet::PACKET_DATA_SIZE`]: https://docs.rs/solana-sdk/latest/solana_sdk/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`] +/// +/// [`solana_sdk::packet::PACKET_DATA_SIZE`]: https://docs.rs/solana-sdk/latest/solana_sdk/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`] +/// +/// [`solana_sdk::packet::PACKET_DATA_SIZE`]: https://docs.rs/solana-sdk/latest/solana_sdk/packet/constant.PACKET_DATA_SIZE.html pub const QUIC_MAX_STAKED_RECEIVE_WINDOW_RATIO: u64 = 512; pub trait NotifyKeyUpdate { diff --git a/sdk/src/lib.rs b/sdk/src/lib.rs index e1d9503a75de20..874a367fd46aa8 100644 --- a/sdk/src/lib.rs +++ b/sdk/src/lib.rs @@ -86,7 +86,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; pub mod reserved_account_keys; @@ -139,6 +138,9 @@ pub use solana_program_memory as program_memory; /// assert_eq!(ID, my_id); /// ``` pub use solana_pubkey::pubkey; +#[cfg(feature = "full")] +#[deprecated(since = "2.1.0", note = "Use `solana-quic-definitions` crate instead")] +pub use solana_quic_definitions as quic; #[deprecated(since = "2.1.0", note = "Use `solana-sanitize` crate instead")] pub use solana_sanitize as sanitize; /// Same as `declare_id` except report that this id has been deprecated.