From bd2b0e016e8e1ad45e4ece5639fcd2ff92dd7111 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 3e7866bd14e162..cd0fe75dc719f6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7501,6 +7501,13 @@ dependencies = [ "tokio", ] +[[package]] +name = "solana-quic-definitions" +version = "2.1.0" +dependencies = [ + "solana-signer", +] + [[package]] name = "solana-rayon-threadlimit" version = "2.1.0" @@ -7874,6 +7881,7 @@ dependencies = [ "solana-presigner", "solana-program", "solana-program-memory", + "solana-quic-definitions", "solana-sanitize", "solana-sdk", "solana-sdk-macro", diff --git a/Cargo.toml b/Cargo.toml index 613da7652bddc6..06eeaff59fb341 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -125,6 +125,7 @@ members = [ "sdk/program-option", "sdk/program-pack", "sdk/pubkey", + "sdk/quic-definitions", "sdk/rent", "sdk/seed-derivable", "sdk/seed-phrase", @@ -453,6 +454,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 88b07ec5ce5d84..6210655c1c761b 100644 --- a/programs/sbf/Cargo.lock +++ b/programs/sbf/Cargo.lock @@ -5872,6 +5872,13 @@ dependencies = [ "tokio", ] +[[package]] +name = "solana-quic-definitions" +version = "2.1.0" +dependencies = [ + "solana-signer", +] + [[package]] name = "solana-rayon-threadlimit" version = "2.1.0" @@ -6644,6 +6651,7 @@ dependencies = [ "solana-presigner", "solana-program", "solana-program-memory", + "solana-quic-definitions", "solana-sanitize", "solana-sdk-macro", "solana-secp256k1-recover", diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml index af19a9967b3aa9..395164b3821bd5 100644 --- a/sdk/Cargo.toml +++ b/sdk/Cargo.toml @@ -100,6 +100,7 @@ solana-frozen-abi-macro = { workspace = true, optional = true, features = [ solana-presigner = { workspace = true, optional = true } solana-program = { workspace = true } solana-program-memory = { workspace = true } +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 11f65d40eedaec..57c2fae443c0cb 100644 --- a/sdk/src/lib.rs +++ b/sdk/src/lib.rs @@ -87,7 +87,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; @@ -118,6 +117,9 @@ pub use solana_derivation_path as derivation_path; pub use solana_feature_set as feature_set; #[deprecated(since = "2.1.0", note = "Use `solana-program-memory` crate instead")] pub use solana_program_memory as program_memory; +#[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.