You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@teaclave.apache.org by "GeminiCarrie (via GitHub)" <gi...@apache.org> on 2023/07/10 06:09:36 UTC

[GitHub] [incubator-teaclave] GeminiCarrie opened a new pull request, #705: Bump tonic to 0.9.2

GeminiCarrie opened a new pull request, #705:
URL: https://github.com/apache/incubator-teaclave/pull/705

   ## Description
   
   - Update tonic and rustls
   - Support setting the gRPC maximum message size
   
   Fixes # (issue)
   
   ## Type of change (select or add applied and delete the others)
   
   - [ ] Bug fix (non-breaking change which fixes an issue)
   - [x] New feature (non-breaking change which adds functionality)
   - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
   - [ ] API change with a documentation update
   - [ ] Additional test coverage
   - [ ] Code cleanup or just sync with upstream third-party crates
   
   ## How has this been tested?
   
   ## Checklist
   
   - [x] Fork the repo and create your branch from `master`.
   - [ ] If you've added code that should be tested, add tests.
   - [ ] If you've changed APIs, update the documentation.
   - [x] Ensure the tests pass (see CI results).
   - [x] Make sure your code lints/format.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@teaclave.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@teaclave.apache.org
For additional commands, e-mail: notifications-help@teaclave.apache.org


[GitHub] [incubator-teaclave] henrysun007 commented on a diff in pull request #705: Bump tonic to 0.9.2

Posted by "henrysun007 (via GitHub)" <gi...@apache.org>.
henrysun007 commented on code in PR #705:
URL: https://github.com/apache/incubator-teaclave/pull/705#discussion_r1260770032


##########
cmake/tomls/Cargo.sgx_untrusted_app.toml:
##########
@@ -45,6 +45,7 @@ sgx_tprotected_fs = { path = "../../../third_party/rust-sgx-sdk/sgx_protected_fs
 sgx_tse           = { path = "../../../third_party/rust-sgx-sdk/sgx_tse" }
 sgx_types         = { path = "../../../third_party/rust-sgx-sdk/sgx_types" }
 sgx_urts          = { path = "../../../third_party/rust-sgx-sdk/sgx_urts" }
+tonic             = { git = "https://github.com/apache/incubator-teaclave-crates" }

Review Comment:
   Put the crate with rustface and rusty-machine together.



##########
cmake/tomls/Cargo.sgx_trusted_lib.toml:
##########
@@ -72,3 +72,4 @@ rusty-machine     = { git = "https://github.com/apache/incubator-teaclave-crates
 tantivy           = { git = "https://github.com/apache/incubator-teaclave-crates" }
 tokio             = { git = "https://github.com/tokio-rs/tokio.git", tag = "tokio-1.24.0"}
 yasna             = { git = "https://github.com/sccommunity/yasna.rs", branch = "teaclave-sgx" }
+tonic             = { git = "https://github.com/apache/incubator-teaclave-crates" }

Review Comment:
   Please keep the crate name in alphabetical order.



##########
examples/rust/builtin_echo/Cargo.toml:
##########
@@ -30,5 +30,6 @@ pem = "0.7.0"
 
 [patch.crates-io]
 h2                = { git = "https://github.com/hyperium/h2", tag = "v0.3.19" }
+tonic             = { git = "https://github.com/apache/incubator-teaclave-crates" }

Review Comment:
   Keep the crate name in alphabetical order.



##########
examples/rust/builtin_ordered_set_intersect/Cargo.toml:
##########
@@ -30,5 +30,6 @@ pem = "0.7.0"
 
 [patch.crates-io]
 h2                = { git = "https://github.com/hyperium/h2", tag = "v0.3.19" }
+tonic             = { git = "https://github.com/apache/incubator-teaclave-crates" }

Review Comment:
   Keep the crate name in alphabetical order.



##########
sdk/rust/Cargo.toml:
##########
@@ -41,5 +41,6 @@ tokio                 = { version = "1.0", features = ["rt-multi-thread", "time"
 
 [patch.crates-io]
 h2                = { git = "https://github.com/hyperium/h2", tag = "v0.3.19" }
+tonic             = { git = "https://github.com/apache/incubator-teaclave-crates" }

Review Comment:
   Keep the crate name in alphabetical order.



##########
examples/rust/sequential_functions/Cargo.toml:
##########
@@ -31,5 +31,6 @@ teaclave_client_sdk   = { path = "../../../sdk/rust/" }
 
 [patch.crates-io]
 h2                = { git = "https://github.com/hyperium/h2", tag = "v0.3.19" }
+tonic             = { git = "https://github.com/apache/incubator-teaclave-crates" }

Review Comment:
   Keep the crate name in alphabetical order.



##########
config/build.config.toml:
##########
@@ -29,8 +29,8 @@ auditor_public_keys = [
     { path = "config/keys/auditors/albus_dumbledore/albus_dumbledore.public.pem"},
 ]
 
-# RPC max message size
-rpc_max_message_size = 409600
+# gRPC max message size
+grpc_max_message_size = 4194304

Review Comment:
   It seems not necessary to change the name. The old name is used in many places. It is better to keep them there.



##########
services/management/enclave/src/service.rs:
##########
@@ -938,7 +939,11 @@ impl TeaclaveManagementService {
             .connect()
             .await
             .map_err(|e| anyhow!("Failed to connect to storage service, {:?}", e))?;
-        let storage_client = Arc::new(Mutex::new(TeaclaveStorageClient::new(channel)));
+        let storage_client = Arc::new(Mutex::new(
+            TeaclaveStorageClient::new(channel)

Review Comment:
   Calling those two max functions with the same parameter seems not smart. How about putting the default configuration in the constructor? 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@teaclave.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@teaclave.apache.org
For additional commands, e-mail: notifications-help@teaclave.apache.org


[GitHub] [incubator-teaclave] henrysun007 commented on a diff in pull request #705: Bump tonic to 0.9.2

Posted by "henrysun007 (via GitHub)" <gi...@apache.org>.
henrysun007 commented on code in PR #705:
URL: https://github.com/apache/incubator-teaclave/pull/705#discussion_r1264785758


##########
services/proto/src/macros.rs:
##########
@@ -0,0 +1,60 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+macro_rules! include_proto {
+    ($package: tt) => {
+        include!(concat!(env!("OUT_DIR"), concat!("/", $package, ".rs")));
+    };
+}
+
+macro_rules! impl_custom_client {
+    ($target: ident) => {
+        impl<T> $target<T>
+        where
+            T: tonic::client::GrpcService<tonic::body::BoxBody>,
+            T::Error: Into<tonic::codegen::StdError>,
+            T::ResponseBody: tonic::codegen::Body<Data = tonic::codegen::Bytes> + Send + 'static,
+            <T::ResponseBody as tonic::codegen::Body>::Error: Into<tonic::codegen::StdError> + Send,
+        {
+            pub fn new_with_builtin_config(inner: T) -> Self {
+                Self::new(inner)
+                    .max_decoding_message_size(
+                        teaclave_config::build::GRPC_CONFIG.max_decoding_message_size,
+                    )
+                    .max_encoding_message_size(
+                        teaclave_config::build::GRPC_CONFIG.max_encoding_message_size,
+                    )
+            }
+        }
+    };
+}
+
+macro_rules! impl_custom_server {
+    ($target: ident,$trait:ident) => {

Review Comment:
   Whitespaces are needed after `,` and `:`.



##########
attestation/src/service.rs:
##########
@@ -117,21 +117,32 @@ impl EndorsedAttestationReport {
     }
 }
 
-fn new_tls_stream(url: &url::Url) -> Result<rustls::StreamOwned<rustls::ClientSession, TcpStream>> {
+fn new_tls_stream(
+    url: &url::Url,
+) -> Result<rustls::StreamOwned<rustls::client::ClientConnection, TcpStream>> {
     let host_str = url
         .host_str()
         .ok_or(AttestationServiceError::InvalidAddress)?;
-    let dns_name = webpki::DNSNameRef::try_from_ascii_str(host_str)?;
-    let mut config = rustls::ClientConfig::new();
+    let mut root_certs = rustls::RootCertStore::empty();
     #[cfg(dcap)]
-    config
-        .root_store
-        .add_pem_file(&mut DCAP_ROOT_CA_CERT.to_string().as_bytes())
-        .map_err(|_| AttestationServiceError::TlsError)?;
-    config
-        .root_store
-        .add_server_trust_anchors(&webpki_roots::TLS_SERVER_ROOTS);
-    let client = rustls::ClientSession::new(&Arc::new(config), dns_name);
+    {
+        let certs = rustls_pemfile::certs(&mut DCAP_ROOT_CA_CERT.to_string().as_bytes())
+            .map_err(|_| AttestationServiceError::TlsError)?;
+        let (valid_count, _) = root_certs.add_parsable_certificates(&certs);
+        anyhow::ensure!(valid_count >= 1, "DCAP_ROOT_CA_CERT error");
+    }
+    root_certs.add_server_trust_anchors(webpki_roots::TLS_SERVER_ROOTS.0.iter().map(|ta| {

Review Comment:
   A more meaningful name rather than `ta` can improve the readability.



##########
rpc/src/config.rs:
##########
@@ -41,10 +41,48 @@ pub struct SgxTrustedTlsServerConfig {
     validity: std::time::Duration,
 }
 
+struct AlwaysResolvesChain(Arc<rustls::sign::CertifiedKey>);

Review Comment:
   Please state here where the code is from.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@teaclave.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@teaclave.apache.org
For additional commands, e-mail: notifications-help@teaclave.apache.org


[GitHub] [incubator-teaclave] henrysun007 merged pull request #705: Bump tonic to 0.9.2

Posted by "henrysun007 (via GitHub)" <gi...@apache.org>.
henrysun007 merged PR #705:
URL: https://github.com/apache/incubator-teaclave/pull/705


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@teaclave.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@teaclave.apache.org
For additional commands, e-mail: notifications-help@teaclave.apache.org