From a69bc7f06b96906bb800da805a8cc29c9ae281e2 Mon Sep 17 00:00:00 2001 From: kevinheavey Date: Wed, 9 Oct 2024 15:17:19 +0400 Subject: [PATCH 1/4] 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 a25b30e0102318..e59f29dc1d7872 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7916,6 +7916,13 @@ dependencies = [ "tokio", ] +[[package]] +name = "solana-quic-definitions" +version = "2.2.0" +dependencies = [ + "solana-keypair", +] + [[package]] name = "solana-rayon-threadlimit" version = "2.2.0" @@ -8325,6 +8332,7 @@ dependencies = [ "solana-program", "solana-program-memory", "solana-pubkey", + "solana-quic-definitions", "solana-reserved-account-keys", "solana-reward-info", "solana-sanitize", diff --git a/Cargo.toml b/Cargo.toml index 8778a641a570dd..438e174e298849 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -140,6 +140,7 @@ members = [ "sdk/program-option", "sdk/program-pack", "sdk/pubkey", + "sdk/quic-definitions", "sdk/rent", "sdk/reserved-account-keys", "sdk/sanitize", @@ -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 } diff --git a/programs/sbf/Cargo.lock b/programs/sbf/Cargo.lock index f6b09c5bceb8b4..3f7e432e150486 100644 --- a/programs/sbf/Cargo.lock +++ b/programs/sbf/Cargo.lock @@ -6246,6 +6246,13 @@ dependencies = [ "tokio", ] +[[package]] +name = "solana-quic-definitions" +version = "2.2.0" +dependencies = [ + "solana-keypair", +] + [[package]] name = "solana-rayon-threadlimit" version = "2.2.0" @@ -7058,6 +7065,7 @@ dependencies = [ "solana-program", "solana-program-memory", "solana-pubkey", + "solana-quic-definitions", "solana-reserved-account-keys", "solana-reward-info", "solana-sanitize", diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml index cfef796073044f..32cb49b4b48602 100644 --- a/sdk/Cargo.toml +++ b/sdk/Cargo.toml @@ -116,6 +116,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-reserved-account-keys = { workspace = true } solana-reward-info = { workspace = true, features = ["serde"] } solana-sanitize = { workspace = true } diff --git a/sdk/quic-definitions/Cargo.toml b/sdk/quic-definitions/Cargo.toml new file mode 100644 index 00000000000000..37ec4c7311fe67 --- /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-keypair = { workspace = true } + +[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..58fbbd9607ee48 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_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 8b52dfa8704d8c..10721132595c5d 100644 --- a/sdk/src/lib.rs +++ b/sdk/src/lib.rs @@ -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")] @@ -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" From 7020cb85a93666eceecf3970b2f0eb8afd587477 Mon Sep 17 00:00:00 2001 From: kevinheavey Date: Sat, 26 Oct 2024 14:52:49 +0400 Subject: [PATCH 2/4] put quic-definitions dep behind "full" feature of sdk --- sdk/Cargo.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml index 32cb49b4b48602..0242b509e35c2b 100644 --- a/sdk/Cargo.toml +++ b/sdk/Cargo.toml @@ -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", @@ -116,7 +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 } +solana-quic-definitions = { workspace = true, optional = true } solana-reserved-account-keys = { workspace = true } solana-reward-info = { workspace = true, features = ["serde"] } solana-sanitize = { workspace = true } From 7ae0d6e8b25e2931630c9d49afa5395c0aff2b27 Mon Sep 17 00:00:00 2001 From: Kevin Heavey Date: Tue, 12 Nov 2024 16:43:31 +0400 Subject: [PATCH 3/4] use solana_packet crate directly Co-authored-by: Jon C --- sdk/quic-definitions/src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sdk/quic-definitions/src/lib.rs b/sdk/quic-definitions/src/lib.rs index 58fbbd9607ee48..f04c4ec0a9bd6a 100644 --- a/sdk/quic-definitions/src/lib.rs +++ b/sdk/quic-definitions/src/lib.rs @@ -31,15 +31,15 @@ pub const QUIC_CONNECTION_HANDSHAKE_TIMEOUT: Duration = Duration::from_secs(60); 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_sdk::packet::PACKET_DATA_SIZE`]: https://docs.rs/solana-sdk/latest/solana_sdk/packet/constant.PACKET_DATA_SIZE.html +/// [`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_sdk::packet::PACKET_DATA_SIZE`]: https://docs.rs/solana-sdk/latest/solana_sdk/packet/constant.PACKET_DATA_SIZE.html +/// [`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 { From 21b91bb05fd41c52b689541a3e643b432cdbf509 Mon Sep 17 00:00:00 2001 From: Kevin Heavey Date: Tue, 12 Nov 2024 16:44:09 +0400 Subject: [PATCH 4/4] use solana_packet crate directly Co-authored-by: Jon C --- sdk/quic-definitions/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/quic-definitions/src/lib.rs b/sdk/quic-definitions/src/lib.rs index f04c4ec0a9bd6a..cb3385991e3242 100644 --- a/sdk/quic-definitions/src/lib.rs +++ b/sdk/quic-definitions/src/lib.rs @@ -25,9 +25,9 @@ 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_sdk::packet::PACKET_DATA_SIZE`]: https://docs.rs/solana-sdk/latest/solana_sdk/packet/constant.PACKET_DATA_SIZE.html +/// [`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