From fa39e4c75cf7c1be0b421977b5d33a8647c99da5 Mon Sep 17 00:00:00 2001 From: raykast Date: Mon, 22 Jul 2024 13:01:12 -0700 Subject: [PATCH] Make Solana crates optional dependencies for proto --- Cargo.toml | 2 +- examples/rust/Cargo.toml | 2 +- yellowstone-grpc-geyser/Cargo.toml | 2 +- yellowstone-grpc-proto/Cargo.toml | 10 +++++++--- yellowstone-grpc-proto/src/lib.rs | 2 ++ 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a5a40b3c..2c8e0429 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -70,7 +70,7 @@ tracing-subscriber = "0.3.17" uuid = "1.8.0" vergen = "9.0.0" yellowstone-grpc-client = { path = "yellowstone-grpc-client", version = "=1.16.0+solana.2.0.2" } -yellowstone-grpc-proto = { path = "yellowstone-grpc-proto", version = "=1.15.0+solana.2.0.2" } +yellowstone-grpc-proto = { path = "yellowstone-grpc-proto", version = "=1.15.0+solana.2.0.2", default-features = false } [profile.release] lto = true diff --git a/examples/rust/Cargo.toml b/examples/rust/Cargo.toml index 682e23e4..3b3d4111 100644 --- a/examples/rust/Cargo.toml +++ b/examples/rust/Cargo.toml @@ -29,4 +29,4 @@ solana-sdk = { workspace = true } solana-transaction-status = { workspace = true } tokio = { workspace = true, features = ["rt-multi-thread"] } yellowstone-grpc-client = { workspace = true } -yellowstone-grpc-proto = { workspace = true } +yellowstone-grpc-proto = { workspace = true, default-features = true } diff --git a/yellowstone-grpc-geyser/Cargo.toml b/yellowstone-grpc-geyser/Cargo.toml index abc915b8..9481b9ea 100644 --- a/yellowstone-grpc-geyser/Cargo.toml +++ b/yellowstone-grpc-geyser/Cargo.toml @@ -40,7 +40,7 @@ tokio = { workspace = true, features = ["rt-multi-thread", "macros", "fs"] } tokio-stream = { workspace = true } tonic = { workspace = true, features = ["gzip", "tls", "tls-roots"] } tonic-health = { workspace = true } -yellowstone-grpc-proto = { workspace = true } +yellowstone-grpc-proto = { workspace = true, features = ["convert"] } [build-dependencies] anyhow = { workspace = true } diff --git a/yellowstone-grpc-proto/Cargo.toml b/yellowstone-grpc-proto/Cargo.toml index 9949ba60..fe58d480 100644 --- a/yellowstone-grpc-proto/Cargo.toml +++ b/yellowstone-grpc-proto/Cargo.toml @@ -13,12 +13,16 @@ publish = true [dependencies] bincode = { workspace = true } prost = { workspace = true } -solana-account-decoder = { workspace = true } -solana-sdk = { workspace = true } -solana-transaction-status = { workspace = true } +solana-account-decoder = { workspace = true, optional = true } +solana-sdk = { workspace = true, optional = true } +solana-transaction-status = { workspace = true, optional = true } tonic = { workspace = true } [build-dependencies] anyhow = { workspace = true } protobuf-src = { workspace = true } tonic-build = { workspace = true } + +[features] +convert = ["dep:solana-account-decoder", "dep:solana-sdk", "dep:solana-transaction-status"] +default = ["convert"] diff --git a/yellowstone-grpc-proto/src/lib.rs b/yellowstone-grpc-proto/src/lib.rs index 18c4242c..510f997d 100644 --- a/yellowstone-grpc-proto/src/lib.rs +++ b/yellowstone-grpc-proto/src/lib.rs @@ -18,6 +18,7 @@ pub mod prelude { pub use {prost, tonic}; +#[cfg(feature = "convert")] pub mod convert_to { use { super::prelude as proto, @@ -265,6 +266,7 @@ pub mod convert_to { } } +#[cfg(feature = "convert")] pub mod convert_from { use { super::prelude as proto,