From def4e8397f19a0786d09d2e364fd6d2e7de569b1 Mon Sep 17 00:00:00 2001 From: Xynnn007 Date: Thu, 12 Sep 2024 16:25:58 +0800 Subject: [PATCH] chore: update prost/tonic/tonic-build deps Close #698 Signed-off-by: Xynnn007 --- Cargo.lock | 157 ++++++++++++---------- Cargo.toml | 6 +- attestation-agent/kbc/Cargo.toml | 2 +- ocicrypt-rs/src/utils/grpc/keyprovider.rs | 61 ++++----- 4 files changed, 118 insertions(+), 108 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 987a5d68e..e413fc862 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -263,6 +263,28 @@ dependencies = [ "zstd-safe 7.2.1", ] +[[package]] +name = "async-stream" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" +dependencies = [ + "async-stream-impl", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-stream-impl" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.50", +] + [[package]] name = "async-trait" version = "0.1.82" @@ -296,7 +318,7 @@ dependencies = [ "kbs-types", "kbs_protocol", "log", - "prost 0.11.9", + "prost 0.13.2", "protobuf 3.5.1", "reqwest 0.12.5", "rstest", @@ -367,18 +389,17 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "axum" -version = "0.6.20" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" +checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf" dependencies = [ "async-trait", "axum-core", - "bitflags 1.3.2", "bytes", "futures-util", - "http 0.2.12", - "http-body 0.4.6", - "hyper 0.14.28", + "http 1.1.0", + "http-body 1.0.0", + "http-body-util", "itoa", "matchit", "memchr", @@ -387,7 +408,7 @@ dependencies = [ "pin-project-lite", "rustversion", "serde", - "sync_wrapper 0.1.2", + "sync_wrapper 1.0.1", "tower", "tower-layer", "tower-service", @@ -395,17 +416,20 @@ dependencies = [ [[package]] name = "axum-core" -version = "0.3.4" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" +checksum = "a15c63fd72d41492dc4f497196f5da1fb04fb7529e631d73630d1b491e47a2e3" dependencies = [ "async-trait", "bytes", "futures-util", - "http 0.2.12", - "http-body 0.4.6", + "http 1.1.0", + "http-body 1.0.0", + "http-body-util", "mime", + "pin-project-lite", "rustversion", + "sync_wrapper 0.1.2", "tower-layer", "tower-service", ] @@ -1013,7 +1037,7 @@ dependencies = [ "futures", "jwt-simple", "log", - "prost 0.11.9", + "prost 0.13.2", "rand", "reqwest 0.12.5", "rstest", @@ -1068,7 +1092,7 @@ dependencies = [ "lazy_static", "log", "nix 0.29.0", - "prost 0.11.9", + "prost 0.13.2", "protobuf 3.5.1", "rstest", "secret", @@ -2572,7 +2596,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2 0.4.10", + "socket2 0.5.5", "tokio", "tower-service", "tracing", @@ -2592,6 +2616,7 @@ dependencies = [ "http 1.1.0", "http-body 1.0.0", "httparse", + "httpdate", "itoa", "pin-project-lite", "smallvec", @@ -2619,14 +2644,15 @@ dependencies = [ [[package]] name = "hyper-timeout" -version = "0.4.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" +checksum = "3203a961e5c83b6f5498933e78b6b263e208c197b63e9c6c53cc82ffd3f63793" dependencies = [ - "hyper 0.14.28", + "hyper 1.3.1", + "hyper-util", "pin-project-lite", "tokio", - "tokio-io-timeout", + "tower-service", ] [[package]] @@ -2780,7 +2806,7 @@ dependencies = [ "oci-client", "oci-spec", "ocicrypt-rs", - "prost 0.11.9", + "prost 0.13.2", "protobuf 3.5.1", "reqwest 0.12.5", "resource_uri", @@ -3094,7 +3120,7 @@ dependencies = [ "foreign-types 0.5.0", "kbs_protocol", "log", - "prost 0.11.9", + "prost 0.13.2", "resource_uri", "rstest", "serde", @@ -3167,7 +3193,7 @@ dependencies = [ "lazy_static", "log", "p12", - "prost 0.11.9", + "prost 0.13.2", "rand", "reqwest 0.12.5", "resource_uri", @@ -3348,7 +3374,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19" dependencies = [ "cfg-if", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -3984,7 +4010,7 @@ dependencies = [ "lazy_static", "openssl", "pin-project-lite", - "prost 0.11.9", + "prost 0.13.2", "protobuf 3.5.1", "resource_uri", "ring", @@ -4498,12 +4524,12 @@ dependencies = [ [[package]] name = "prettyplease" -version = "0.1.25" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8646e95016a7a6c4adea95bafa8a16baab64b583356217f2c85db4a39d9a86" +checksum = "8d3928fb5db768cb86f891ff014f0144589297e3c6a1aba6ed7cecfdace270c7" dependencies = [ "proc-macro2", - "syn 1.0.109", + "syn 2.0.50", ] [[package]] @@ -4560,12 +4586,12 @@ dependencies = [ [[package]] name = "prost" -version = "0.11.9" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" +checksum = "3b2ecbe40f08db5c006b5764a2645f7f3f141ce756412ac9e1dd6087e6d32995" dependencies = [ "bytes", - "prost-derive 0.11.9", + "prost-derive 0.13.2", ] [[package]] @@ -4588,24 +4614,23 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.11.9" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270" +checksum = "f8650aabb6c35b860610e9cff5dc1af886c9e25073b7b1712a68972af4281302" dependencies = [ "bytes", - "heck 0.4.1", - "itertools 0.10.5", - "lazy_static", + "heck 0.5.0", + "itertools 0.11.0", "log", "multimap", + "once_cell", "petgraph 0.6.4", "prettyplease", - "prost 0.11.9", - "prost-types 0.11.9", + "prost 0.13.2", + "prost-types 0.13.2", "regex", - "syn 1.0.109", + "syn 2.0.50", "tempfile", - "which", ] [[package]] @@ -4623,15 +4648,15 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.11.9" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" +checksum = "acf0c195eebb4af52c752bec4f52f645da98b6e92077a04110c7f349477ae5ac" dependencies = [ "anyhow", - "itertools 0.10.5", + "itertools 0.11.0", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.50", ] [[package]] @@ -4646,11 +4671,11 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.11.9" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13" +checksum = "60caa6738c7369b940c3d49246a8d1749323674c65cb13010134f5c9bad5b519" dependencies = [ - "prost 0.11.9", + "prost 0.13.2", ] [[package]] @@ -6290,16 +6315,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "tokio-io-timeout" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" -dependencies = [ - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-macros" version = "2.4.0" @@ -6428,24 +6443,26 @@ dependencies = [ [[package]] name = "tonic" -version = "0.9.2" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3082666a3a6433f7f511c7192923fa1fe07c69332d3c6a2e6bb040b569199d5a" +checksum = "c6f6ba989e4b2c58ae83d862d3a3e27690b6e3ae630d0deb59f3697f32aa88ad" dependencies = [ + "async-stream", "async-trait", "axum", - "base64 0.21.7", + "base64 0.22.1", "bytes", - "futures-core", - "futures-util", - "h2 0.3.26", - "http 0.2.12", - "http-body 0.4.6", - "hyper 0.14.28", + "h2 0.4.5", + "http 1.1.0", + "http-body 1.0.0", + "http-body-util", + "hyper 1.3.1", "hyper-timeout", + "hyper-util", "percent-encoding", "pin-project", - "prost 0.11.9", + "prost 0.13.2", + "socket2 0.5.5", "tokio", "tokio-stream", "tower", @@ -6456,15 +6473,15 @@ dependencies = [ [[package]] name = "tonic-build" -version = "0.9.2" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6fdaae4c2c638bb70fe42803a26fbd6fc6ac8c72f5c59f67ecc2a2dcabf4b07" +checksum = "fe4ee8877250136bd7e3d2331632810a4df4ea5e004656990d8d66d2f5ee8a67" dependencies = [ "prettyplease", "proc-macro2", - "prost-build 0.11.9", + "prost-build 0.13.2", "quote", - "syn 1.0.109", + "syn 2.0.50", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index b575169de..18fafa718 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -44,7 +44,7 @@ lazy_static = "1.5.0" log = "0.4.22" nix = "0.29" openssl = "0.10" -prost = "0.11" +prost = "0.13" protobuf = "3.5.1" rand = "0.8.5" reqwest = { version = "0.12", default-features = false } @@ -63,8 +63,8 @@ testcontainers = "0.14" thiserror = "1.0" tokio = "1.39" toml = "0.8.19" -tonic = "0.9" -tonic-build = "0.9" +tonic = "0.12" +tonic-build = "0.12" ttrpc = "0.8.0" ttrpc-codegen = "0.4.2" url = "2.5.2" diff --git a/attestation-agent/kbc/Cargo.toml b/attestation-agent/kbc/Cargo.toml index c53aebf9e..69a435886 100644 --- a/attestation-agent/kbc/Cargo.toml +++ b/attestation-agent/kbc/Cargo.toml @@ -31,7 +31,7 @@ tokio = { workspace = true, features = ["macros", "rt-multi-thread"] } rstest.workspace = true [build-dependencies] -tonic-build = { version = "0.9.2", optional = true } +tonic-build = { workspace = true, optional = true } [features] default = ["sample_kbc", "rust-crypto"] diff --git a/ocicrypt-rs/src/utils/grpc/keyprovider.rs b/ocicrypt-rs/src/utils/grpc/keyprovider.rs index 48f669119..1b3a2d4a7 100644 --- a/ocicrypt-rs/src/utils/grpc/keyprovider.rs +++ b/ocicrypt-rs/src/utils/grpc/keyprovider.rs @@ -1,10 +1,9 @@ -#[allow(clippy::derive_partial_eq_without_eq)] +// This file is @generated by prost-build. #[derive(Clone, PartialEq, ::prost::Message)] pub struct KeyProviderKeyWrapProtocolInput { #[prost(bytes = "vec", tag = "1")] pub key_provider_key_wrap_protocol_input: ::prost::alloc::vec::Vec, } -#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct KeyProviderKeyWrapProtocolOutput { #[prost(bytes = "vec", tag = "1")] @@ -34,8 +33,8 @@ pub mod key_provider_service_client { where T: tonic::client::GrpcService, T::Error: Into, - T::ResponseBody: Body + Send + 'static, - ::Error: Into + Send, + T::ResponseBody: Body + std::marker::Send + 'static, + ::Error: Into + std::marker::Send, { pub fn new(inner: T) -> Self { let inner = tonic::client::Grpc::new(inner); @@ -60,7 +59,7 @@ pub mod key_provider_service_client { >, , - >>::Error: Into + Send + Sync, + >>::Error: Into + std::marker::Send + std::marker::Sync, { KeyProviderServiceClient::new(InterceptedService::new(inner, interceptor)) } @@ -153,7 +152,7 @@ pub mod key_provider_service_server { use tonic::codegen::*; /// Generated trait containing gRPC methods that should be implemented for use with KeyProviderServiceServer. #[async_trait] - pub trait KeyProviderService: Send + Sync + 'static { + pub trait KeyProviderService: std::marker::Send + std::marker::Sync + 'static { async fn wrap_key( &self, request: tonic::Request, @@ -170,20 +169,18 @@ pub mod key_provider_service_server { >; } #[derive(Debug)] - pub struct KeyProviderServiceServer { - inner: _Inner, + pub struct KeyProviderServiceServer { + inner: Arc, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, max_decoding_message_size: Option, max_encoding_message_size: Option, } - struct _Inner(Arc); - impl KeyProviderServiceServer { + impl KeyProviderServiceServer { pub fn new(inner: T) -> Self { Self::from_arc(Arc::new(inner)) } pub fn from_arc(inner: Arc) -> Self { - let inner = _Inner(inner); Self { inner, accept_compression_encodings: Default::default(), @@ -233,8 +230,8 @@ pub mod key_provider_service_server { impl tonic::codegen::Service> for KeyProviderServiceServer where T: KeyProviderService, - B: Body + Send + 'static, - B::Error: Into + Send + 'static, + B: Body + std::marker::Send + 'static, + B::Error: Into + std::marker::Send + 'static, { type Response = http::Response; type Error = std::convert::Infallible; @@ -246,7 +243,6 @@ pub mod key_provider_service_server { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { - let inner = self.inner.clone(); match req.uri().path() { "/keyprovider.KeyProviderService/WrapKey" => { #[allow(non_camel_case_types)] @@ -267,7 +263,9 @@ pub mod key_provider_service_server { >, ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { (*inner).wrap_key(request).await }; + let fut = async move { + ::wrap_key(&inner, request).await + }; Box::pin(fut) } } @@ -277,7 +275,6 @@ pub mod key_provider_service_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = WrapKeySvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -313,7 +310,10 @@ pub mod key_provider_service_server { >, ) -> Self::Future { let inner = Arc::clone(&self.0); - let fut = async move { (*inner).un_wrap_key(request).await }; + let fut = async move { + ::un_wrap_key(&inner, request) + .await + }; Box::pin(fut) } } @@ -323,7 +323,6 @@ pub mod key_provider_service_server { let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { - let inner = inner.0; let method = UnWrapKeySvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -345,8 +344,11 @@ pub mod key_provider_service_server { Ok( http::Response::builder() .status(200) - .header("grpc-status", "12") - .header("content-type", "application/grpc") + .header("grpc-status", tonic::Code::Unimplemented as i32) + .header( + http::header::CONTENT_TYPE, + tonic::metadata::GRPC_CONTENT_TYPE, + ) .body(empty_body()) .unwrap(), ) @@ -355,7 +357,7 @@ pub mod key_provider_service_server { } } } - impl Clone for KeyProviderServiceServer { + impl Clone for KeyProviderServiceServer { fn clone(&self) -> Self { let inner = self.inner.clone(); Self { @@ -367,18 +369,9 @@ pub mod key_provider_service_server { } } } - impl Clone for _Inner { - fn clone(&self) -> Self { - Self(Arc::clone(&self.0)) - } - } - impl std::fmt::Debug for _Inner { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{:?}", self.0) - } - } - impl tonic::server::NamedService - for KeyProviderServiceServer { - const NAME: &'static str = "keyprovider.KeyProviderService"; + /// Generated gRPC service name + pub const SERVICE_NAME: &str = "keyprovider.KeyProviderService"; + impl tonic::server::NamedService for KeyProviderServiceServer { + const NAME: &'static str = SERVICE_NAME; } }