diff --git a/Cargo.lock b/Cargo.lock index 5f85a30d1..ea70ea092 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -938,7 +938,6 @@ dependencies = [ "thiserror", "time", "tls_codec", - "tracing", "uniffi", "url", "uuid", @@ -977,8 +976,6 @@ dependencies = [ "strum", "thiserror", "tls_codec", - "tracing", - "tracing-subscriber", "uniffi", "wasm-bindgen", "wasm-bindgen-futures", @@ -2842,16 +2839,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "nu-ansi-term" -version = "0.46.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" -dependencies = [ - "overload", - "winapi", -] - [[package]] name = "num-complex" version = "0.4.6" @@ -3065,12 +3052,6 @@ dependencies = [ "serde", ] -[[package]] -name = "overload" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" - [[package]] name = "owo-colors" version = "3.5.0" @@ -4826,42 +4807,15 @@ dependencies = [ "tracing-subscriber", ] -[[package]] -name = "tracing-log" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" -dependencies = [ - "log", - "once_cell", - "tracing-core", -] - -[[package]] -name = "tracing-serde" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1" -dependencies = [ - "serde", - "tracing-core", -] - [[package]] name = "tracing-subscriber" version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" dependencies = [ - "nu-ansi-term", - "serde", - "serde_json", "sharded-slab", - "smallvec", "thread_local", "tracing-core", - "tracing-log", - "tracing-serde", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 8345c18cc..b62d62a65 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,7 +32,7 @@ hex = "0.4" idb = "0.6" indexmap = "2" itertools = "0.13" -log = "0.4" +log = { version = "0.4", features = ["kv"] } mls-crypto-provider = { path = "mls-provider" } pem = "3.0" rand = { version = "0.8", features = ["getrandom"] } @@ -45,8 +45,6 @@ sha2 = "0.10" strum = { version = "0.26", features = ["derive"] } thiserror = "1.0" tls_codec = "0.4.1" -tracing = "0.1" -tracing-subscriber = { version = "0.3", features = ["json"] } uniffi = "0.28" url = "2.5" uuid = "1.11" diff --git a/crypto-ffi/Cargo.toml b/crypto-ffi/Cargo.toml index 376135c23..9ba679e1e 100644 --- a/crypto-ffi/Cargo.toml +++ b/crypto-ffi/Cargo.toml @@ -27,8 +27,6 @@ futures-util.workspace = true async-trait.workspace = true tls_codec.workspace = true async-lock.workspace = true -tracing.workspace = true -tracing-subscriber.workspace = true log.workspace = true # see https://github.com/RustCrypto/hashes/issues/404 diff --git a/crypto/Cargo.toml b/crypto/Cargo.toml index 2a99b670a..a99890c37 100644 --- a/crypto/Cargo.toml +++ b/crypto/Cargo.toml @@ -52,7 +52,6 @@ uniffi = { workspace = true, optional = true } itertools.workspace = true uuid.workspace = true base64.workspace = true -tracing.workspace = true log.workspace = true proteus-wasm = { workspace = true, features = ["hazmat"], optional = true } proteus-traits = { workspace = true, optional = true } diff --git a/crypto/src/e2e_identity/conversation_state.rs b/crypto/src/e2e_identity/conversation_state.rs index 389f5b6b1..888050cfa 100644 --- a/crypto/src/e2e_identity/conversation_state.rs +++ b/crypto/src/e2e_identity/conversation_state.rs @@ -32,7 +32,6 @@ pub enum E2eiConversationState { impl MlsCentral { /// Indicates when to mark a conversation as not verified i.e. when not all its members have a X509 /// Credential generated by Wire's end-to-end identity enrollment - #[cfg_attr(not(test), tracing::instrument(err, skip(self), fields(id = base64::Engine::encode(&base64::prelude::BASE64_STANDARD, id))))] pub async fn e2ei_conversation_state(&mut self, id: &ConversationId) -> CryptoResult { let conversation = self.get_conversation(id).await?; let conversation_lock = conversation.read().await; @@ -41,7 +40,6 @@ impl MlsCentral { } /// Verifies a Group state before joining it - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub async fn e2ei_verify_group_state( &self, group_info: VerifiableGroupInfo, @@ -74,7 +72,6 @@ impl MlsCentral { /// Gets the e2ei conversation state from a `GroupInfo`. Useful to check if the group has e2ei /// turned on or not before joining it. - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub async fn get_credential_in_use( &self, group_info: VerifiableGroupInfo, @@ -93,7 +90,6 @@ impl MlsCentral { .await } - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] async fn get_credential_in_use_in_ratchet_tree( &self, ciphersuite: MlsCiphersuite, @@ -115,7 +111,6 @@ impl MlsCentral { } impl MlsConversation { - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] async fn e2ei_conversation_state(&self, backend: &MlsCryptoProvider) -> CryptoResult { backend.authentication_service().refresh_time_of_interest().await; Ok(compute_state( @@ -130,7 +125,6 @@ impl MlsConversation { /// _credential_type will be used in the future to get the usage of VC Credentials, even Basics one. /// Right now though, we do not need anything other than X509 so let's keep things simple. -#[cfg_attr(not(test), tracing::instrument(ret, skip(credentials, env)))] pub(crate) async fn compute_state<'a>( ciphersuite: MlsCiphersuite, credentials: impl Iterator, diff --git a/crypto/src/e2e_identity/crypto.rs b/crypto/src/e2e_identity/crypto.rs index 5529240f7..08793ea09 100644 --- a/crypto/src/e2e_identity/crypto.rs +++ b/crypto/src/e2e_identity/crypto.rs @@ -11,7 +11,6 @@ use wire_e2e_identity::prelude::JwsAlgorithm; use zeroize::Zeroize; impl super::E2eiEnrollment { - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub(super) fn new_sign_key( ciphersuite: MlsCiphersuite, backend: &MlsCryptoProvider, @@ -23,7 +22,6 @@ impl super::E2eiEnrollment { E2eiSignatureKeypair::try_new(ciphersuite.signature_algorithm(), sk) } - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub(super) fn get_sign_key_for_mls(&self) -> CryptoResult> { let sk = match self.ciphersuite.signature_algorithm() { SignatureScheme::ECDSA_SECP256R1_SHA256 | SignatureScheme::ECDSA_SECP384R1_SHA384 => self.sign_sk.to_vec(), diff --git a/crypto/src/e2e_identity/enabled.rs b/crypto/src/e2e_identity/enabled.rs index e47d29813..26305cb22 100644 --- a/crypto/src/e2e_identity/enabled.rs +++ b/crypto/src/e2e_identity/enabled.rs @@ -5,7 +5,6 @@ use openmls_traits::types::SignatureScheme; impl MlsCentral { /// Returns true when end-to-end-identity is enabled for the given SignatureScheme - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub fn e2ei_is_enabled(&self, signature_scheme: SignatureScheme) -> CryptoResult { let client = self.mls_client.as_ref().ok_or(CryptoError::MlsNotInitialized)?; let maybe_x509 = client.find_most_recent_credential_bundle(signature_scheme, MlsCredentialType::X509); diff --git a/crypto/src/e2e_identity/identity.rs b/crypto/src/e2e_identity/identity.rs index 52209bf88..087727025 100644 --- a/crypto/src/e2e_identity/identity.rs +++ b/crypto/src/e2e_identity/identity.rs @@ -82,7 +82,6 @@ impl MlsCentral { /// From a given conversation, get the identity of the members supplied. Identity is only present for /// members with a Certificate Credential (after turning on end-to-end identity). /// If no member has a x509 certificate, it will return an empty Vec - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub async fn get_device_identities( &mut self, conversation_id: &ConversationId, @@ -108,7 +107,6 @@ impl MlsCentral { /// /// Returns a Map with all the identities for a given users. Consumers are then recommended to /// reduce those identities to determine the actual status of a user. - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub async fn get_user_identities( &mut self, conversation_id: &ConversationId, @@ -130,7 +128,6 @@ impl MlsCentral { } impl MlsConversation { - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] fn get_device_identities( &self, device_ids: &[ClientId], @@ -146,7 +143,6 @@ impl MlsConversation { .collect::>>() } - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] fn get_user_identities( &self, user_ids: &[String], diff --git a/crypto/src/e2e_identity/init_certificates.rs b/crypto/src/e2e_identity/init_certificates.rs index 42536b4f9..abe972498 100644 --- a/crypto/src/e2e_identity/init_certificates.rs +++ b/crypto/src/e2e_identity/init_certificates.rs @@ -37,7 +37,6 @@ impl MlsCentral { } /// Dumps the PKI environment as PEM - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub async fn e2ei_dump_pki_env(&self) -> CryptoResult> { if !self.e2ei_is_pki_env_setup().await { return Ok(None); @@ -106,7 +105,6 @@ impl MlsCentral { /// /// # Parameters /// * `trust_anchor_pem` - PEM certificate to anchor as a Trust Root - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub async fn e2ei_register_acme_ca(&self, trust_anchor_pem: String) -> CryptoResult<()> { { let mut conn = self.mls_backend.key_store().borrow_conn().await?; @@ -154,14 +152,12 @@ impl MlsCentral { /// /// # Parameters /// * `cert_pem` - PEM certificate to register as an Intermediate CA - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub async fn e2ei_register_intermediate_ca_pem(&self, cert_pem: String) -> CryptoResult { // Parse/decode PEM cert let inter_ca = PkiEnvironment::decode_pem_cert(cert_pem).map_err(|e| CryptoError::E2eiError(e.into()))?; self.e2ei_register_intermediate_ca(inter_ca).await } - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub(crate) async fn e2ei_register_intermediate_ca_der( &self, cert_der: &[u8], @@ -170,7 +166,6 @@ impl MlsCentral { self.e2ei_register_intermediate_ca(inter_ca).await } - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] async fn e2ei_register_intermediate_ca( &self, inter_ca: x509_cert::Certificate, @@ -230,7 +225,6 @@ impl MlsCentral { /// /// # Returns /// A [CrlRegistration] with the dirty state of the new CRL (see struct) and its expiration timestamp - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub async fn e2ei_register_crl(&self, crl_dp: String, crl_der: Vec) -> CryptoResult { // Parse & Validate CRL let crl = { @@ -269,7 +263,6 @@ impl MlsCentral { Ok(CrlRegistration { expiration, dirty }) } - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub(crate) async fn init_pki_env(&self) -> CryptoResult<()> { if let Some(pki_env) = Self::restore_pki_env(&self.mls_backend).await? { self.mls_backend.update_pki_env(pki_env).await?; @@ -278,7 +271,6 @@ impl MlsCentral { Ok(()) } - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub(crate) async fn restore_pki_env(backend: &MlsCryptoProvider) -> CryptoResult> { let keystore = backend.key_store(); let mut conn = keystore.borrow_conn().await?; diff --git a/crypto/src/e2e_identity/mod.rs b/crypto/src/e2e_identity/mod.rs index 63df04340..d20783795 100644 --- a/crypto/src/e2e_identity/mod.rs +++ b/crypto/src/e2e_identity/mod.rs @@ -51,7 +51,6 @@ impl MlsCentral { /// * `display_name` - human readable name displayed in the application e.g. `Smith, Alice M (QA)` /// * `handle` - user handle e.g. `alice.smith.qa@example.com` /// * `expiry_sec` - generated x509 certificate expiry in seconds - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub fn e2ei_new_enrollment( &self, client_id: ClientId, @@ -78,7 +77,6 @@ impl MlsCentral { /// Parses the ACME server response from the endpoint fetching x509 certificates and uses it /// to initialize the MLS client with a certificate - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub async fn e2ei_mls_init_only( &mut self, enrollment: &mut E2eiEnrollment, @@ -155,7 +153,6 @@ impl E2eiEnrollment { /// * `handle` - user handle e.g. `alice.smith.qa@example.com` /// * `expiry_sec` - generated x509 certificate expiry in seconds #[allow(clippy::too_many_arguments)] - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub fn try_new( client_id: ClientId, display_name: String, @@ -205,7 +202,6 @@ impl E2eiEnrollment { /// /// # Parameters /// * `directory` - http response body - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub fn directory_response(&mut self, directory: Json) -> E2eIdentityResult { let directory = serde_json::from_slice(&directory[..])?; let directory: types::E2eiAcmeDirectory = self.acme_directory_response(directory)?.into(); @@ -221,7 +217,6 @@ impl E2eiEnrollment { /// # Parameters /// * `directory` - you got from [Self::directory_response] /// * `previous_nonce` - you got from calling `HEAD {directory.new_nonce}` - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub fn new_account_request(&self, previous_nonce: String) -> E2eIdentityResult { let directory = self.directory.as_ref().ok_or(E2eIdentityError::OutOfOrderEnrollment( "You must first call 'directoryResponse()'", @@ -237,7 +232,6 @@ impl E2eiEnrollment { /// /// # Parameters /// * `account` - http response body - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub fn new_account_response(&mut self, account: Json) -> E2eIdentityResult<()> { let account = serde_json::from_slice(&account[..])?; let account = self.acme_new_account_response(account)?; @@ -251,7 +245,6 @@ impl E2eiEnrollment { /// /// # Parameters /// * `previous_nonce` - `replay-nonce` response header from `POST /acme/{provisioner-name}/new-account` - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub fn new_order_request(&self, previous_nonce: String) -> E2eIdentityResult { let directory = self.directory.as_ref().ok_or(E2eIdentityError::OutOfOrderEnrollment( "You must first call 'directoryResponse()'", @@ -278,7 +271,6 @@ impl E2eiEnrollment { /// /// # Parameters /// * `new_order` - http response body - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub fn new_order_response(&self, order: Json) -> E2eIdentityResult { let order = serde_json::from_slice(&order[..])?; self.acme_new_order_response(order)?.try_into() @@ -292,8 +284,7 @@ impl E2eiEnrollment { /// * `url` - one of the URL in new order's authorizations (from [Self::new_order_response]) /// * `account` - you got from [Self::new_account_response] /// * `previous_nonce` - `replay-nonce` response header from `POST /acme/{provisioner-name}/new-order` - /// (or from the previous to this method if you are creating the second authorization) - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] + /// (or from the previous to this method if you are creating the second authorization) pub fn new_authz_request(&self, url: String, previous_nonce: String) -> E2eIdentityResult { let account = self.account.as_ref().ok_or(E2eIdentityError::OutOfOrderEnrollment( "You must first call 'newAccountResponse()'", @@ -309,7 +300,6 @@ impl E2eiEnrollment { /// /// # Parameters /// * `new_authz` - http response body - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub fn new_authz_response(&mut self, authz: Json) -> E2eIdentityResult { let authz = serde_json::from_slice(&authz[..])?; let authz = self.acme_new_authz_response(authz)?; @@ -331,10 +321,9 @@ impl E2eiEnrollment { /// # Parameters /// * `expiry_secs` - of the client Dpop JWT. This should be equal to the grace period set in Team Management /// * `backend_nonce` - you get by calling `GET /clients/token/nonce` on wire-server. - /// See endpoint [definition](https://staging-nginz-https.zinfra.io/api/swagger-ui/#/default/get_clients__client__nonce) + /// See endpoint [definition](https://staging-nginz-https.zinfra.io/api/swagger-ui/#/default/get_clients__client__nonce) /// * `expiry` - token expiry #[allow(clippy::too_many_arguments)] - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub fn create_dpop_token(&self, expiry_secs: u32, backend_nonce: String) -> E2eIdentityResult { let expiry = core::time::Duration::from_secs(expiry_secs as u64); let authz = self @@ -367,7 +356,6 @@ impl E2eiEnrollment { /// * `dpop_challenge` - you found after [Self::new_authz_response] /// * `account` - you got from [Self::new_account_response] /// * `previous_nonce` - `replay-nonce` response header from `POST /acme/{provisioner-name}/authz/{authz-id}` - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub fn new_dpop_challenge_request(&self, access_token: String, previous_nonce: String) -> E2eIdentityResult { let authz = self .device_authz @@ -393,7 +381,6 @@ impl E2eiEnrollment { /// /// # Parameters /// * `challenge` - http response body - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub fn new_dpop_challenge_response(&self, challenge: Json) -> E2eIdentityResult<()> { let challenge = serde_json::from_slice(&challenge[..])?; Ok(self.acme_new_challenge_response(challenge)?) @@ -409,7 +396,6 @@ impl E2eiEnrollment { /// * `oidc_challenge` - you found after [Self::new_authz_response] /// * `account` - you got from [Self::new_account_response] /// * `previous_nonce` - `replay-nonce` response header from `POST /acme/{provisioner-name}/authz/{authz-id}` - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub fn new_oidc_challenge_request( &mut self, id_token: String, @@ -447,7 +433,6 @@ impl E2eiEnrollment { /// /// # Parameters /// * `challenge` - http response body - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub async fn new_oidc_challenge_response( &mut self, #[cfg(not(target_family = "wasm"))] backend: &MlsCryptoProvider, @@ -478,7 +463,6 @@ impl E2eiEnrollment { /// * `order_url` - `location` header from http response you got from [Self::new_order_response] /// * `account` - you got from [Self::new_account_response] /// * `previous_nonce` - `replay-nonce` response header from `POST /acme/{provisioner-name}/challenge/{challenge-id}` - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub fn check_order_request(&self, order_url: String, previous_nonce: String) -> E2eIdentityResult { let account = self.account.as_ref().ok_or(E2eIdentityError::OutOfOrderEnrollment( "You must first call 'newAccountResponse()'", @@ -497,7 +481,6 @@ impl E2eiEnrollment { /// /// # Returns /// The finalize url to use with [Self::finalize_request] - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub fn check_order_response(&mut self, order: Json) -> E2eIdentityResult { let order = serde_json::from_slice(&order[..])?; let valid_order = self.acme_check_order_response(order)?; @@ -515,7 +498,6 @@ impl E2eiEnrollment { /// * `order` - you got from [Self::check_order_response] /// * `account` - you got from [Self::new_account_response] /// * `previous_nonce` - `replay-nonce` response header from `POST /acme/{provisioner-name}/order/{order-id}` - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub fn finalize_request(&mut self, previous_nonce: String) -> E2eIdentityResult { let account = self.account.as_ref().ok_or(E2eIdentityError::OutOfOrderEnrollment( "You must first call 'newAccountResponse()'", @@ -537,7 +519,6 @@ impl E2eiEnrollment { /// /// # Returns /// The certificate url to use with [Self::certificate_request] - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub fn finalize_response(&mut self, finalize: Json) -> E2eIdentityResult { let finalize = serde_json::from_slice(&finalize[..])?; let finalize = self.acme_finalize_response(finalize)?; @@ -554,7 +535,6 @@ impl E2eiEnrollment { /// * `finalize` - you got from [Self::finalize_response] /// * `account` - you got from [Self::new_account_response] /// * `previous_nonce` - `replay-nonce` response header from `POST /acme/{provisioner-name}/order/{order-id}/finalize` - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub fn certificate_request(&mut self, previous_nonce: String) -> E2eIdentityResult { let account = self.account.take().ok_or(E2eIdentityError::OutOfOrderEnrollment( "You must first call 'newAccountResponse()'", @@ -567,7 +547,6 @@ impl E2eiEnrollment { Ok(certificate) } - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] async fn certificate_response( &mut self, certificate_chain: String, diff --git a/crypto/src/e2e_identity/refresh_token.rs b/crypto/src/e2e_identity/refresh_token.rs index aef4041db..53779c67d 100644 --- a/crypto/src/e2e_identity/refresh_token.rs +++ b/crypto/src/e2e_identity/refresh_token.rs @@ -20,7 +20,6 @@ impl E2eiEnrollment { /// Lets clients retrieve the OIDC refresh token to try to renew the user's authorization. /// If it's expired, the user needs to reauthenticate and they will update the refresh token /// in [E2eiEnrollment::new_oidc_challenge_request] - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub fn get_refresh_token(&self) -> E2eIdentityResult<&str> { self.refresh_token .as_ref() @@ -30,7 +29,6 @@ impl E2eiEnrollment { )) } - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub(crate) async fn replace_refresh_token( &self, backend: &MlsCryptoProvider, @@ -43,7 +41,6 @@ impl E2eiEnrollment { } impl MlsCentral { - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub(crate) async fn find_refresh_token(&self) -> CryptoResult { let mut conn = self.mls_backend.key_store().borrow_conn().await?; E2eiRefreshToken::find_unique(&mut conn).await?.try_into() diff --git a/crypto/src/e2e_identity/rotate.rs b/crypto/src/e2e_identity/rotate.rs index 2930a29f9..95761b781 100644 --- a/crypto/src/e2e_identity/rotate.rs +++ b/crypto/src/e2e_identity/rotate.rs @@ -22,7 +22,6 @@ impl MlsCentral { /// ClientId which should remain the same as the Basic one. /// Once the enrollment is finished, use the instance in [MlsCentral::e2ei_rotate_all] to do /// the rotation. - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub fn e2ei_new_activation_enrollment( &self, display_name: String, @@ -60,7 +59,6 @@ impl MlsCentral { /// has been revoked. As a consequence, this method does not support changing neither ClientId which /// should remain the same as the previous one. It lets you change the DisplayName or the handle /// if you need to. Once the enrollment is finished, use the instance in [MlsCentral::e2ei_rotate_all] to do the rotation. - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub async fn e2ei_new_rotate_enrollment( &self, display_name: Option, @@ -103,7 +101,6 @@ impl MlsCentral { /// Creates a commit in all local conversations for changing the credential. Requires first /// having enrolled a new X509 certificate with either [MlsCentral::e2ei_new_activation_enrollment] /// or [MlsCentral::e2ei_new_rotate_enrollment] - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub async fn e2ei_rotate_all( &mut self, enrollment: &mut E2eiEnrollment, @@ -160,7 +157,6 @@ impl MlsCentral { }) } - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] async fn find_key_packages_to_remove(&self, cb: &CredentialBundle) -> CryptoResult> { let nb_kp = self.mls_backend.key_store().count::().await?; let kps: Vec = self.mls_backend.key_store().mls_fetch_keypackages(nb_kp as u32).await?; @@ -189,7 +185,6 @@ impl MlsCentral { Ok(kp_refs) } - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] async fn e2ei_update_all( &mut self, cb: &CredentialBundle, @@ -211,7 +206,6 @@ impl MlsCentral { /// Creates a commit in a conversation for changing the credential. Requires first /// having enrolled a new X509 certificate with either [MlsCentral::e2ei_new_activation_enrollment] /// or [MlsCentral::e2ei_new_rotate_enrollment] - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub async fn e2ei_rotate( &mut self, id: &crate::prelude::ConversationId, @@ -228,7 +222,6 @@ impl MlsCentral { impl MlsConversation { #[cfg_attr(test, crate::durable)] - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub(crate) async fn e2ei_rotate( &mut self, backend: &MlsCryptoProvider, diff --git a/crypto/src/e2e_identity/stash.rs b/crypto/src/e2e_identity/stash.rs index e71d621e4..e35eb709c 100644 --- a/crypto/src/e2e_identity/stash.rs +++ b/crypto/src/e2e_identity/stash.rs @@ -10,7 +10,6 @@ use crate::prelude::{CryptoError, CryptoResult, E2eiEnrollment, MlsCentral}; pub(crate) type EnrollmentHandle = Vec; impl E2eiEnrollment { - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub(crate) async fn stash(self, backend: &MlsCryptoProvider) -> CryptoResult { // should be enough to prevent collisions const HANDLE_SIZE: usize = 32; @@ -25,7 +24,6 @@ impl E2eiEnrollment { Ok(handle) } - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub(crate) async fn stash_pop(backend: &MlsCryptoProvider, handle: EnrollmentHandle) -> CryptoResult { let content = backend .key_store() @@ -45,7 +43,6 @@ impl MlsCentral { /// /// # Returns /// A handle for retrieving the enrollment later on - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub async fn e2ei_enrollment_stash(&self, enrollment: E2eiEnrollment) -> CryptoResult { enrollment.stash(&self.mls_backend).await } @@ -54,7 +51,6 @@ impl MlsCentral { /// /// # Arguments /// * `handle` - returned by [MlsCentral::e2ei_enrollment_stash] - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub async fn e2ei_enrollment_stash_pop(&self, handle: EnrollmentHandle) -> CryptoResult { E2eiEnrollment::stash_pop(&self.mls_backend, handle).await } diff --git a/crypto/src/mls/buffer_external_commit.rs b/crypto/src/mls/buffer_external_commit.rs index dc255f08f..e4cdbca97 100644 --- a/crypto/src/mls/buffer_external_commit.rs +++ b/crypto/src/mls/buffer_external_commit.rs @@ -9,7 +9,6 @@ use crate::prelude::{ConversationId, CryptoError, CryptoResult, MlsCentral, MlsC use core_crypto_keystore::entities::{MlsPendingMessage, PersistedMlsPendingGroup}; impl MlsCentral { - #[cfg_attr(not(test), tracing::instrument(err, skip(self, message), fields(id = base64::Engine::encode(&base64::prelude::BASE64_STANDARD, id))))] pub(crate) async fn handle_when_group_is_pending( &mut self, id: &ConversationId, diff --git a/crypto/src/mls/client/identifier.rs b/crypto/src/mls/client/identifier.rs index 125c1b42f..38073433a 100644 --- a/crypto/src/mls/client/identifier.rs +++ b/crypto/src/mls/client/identifier.rs @@ -36,7 +36,6 @@ impl ClientIdentifier { /// Generate a new CredentialBundle (Credential + KeyPair) for each ciphersuite. /// This method does not persist them in the keystore ! - #[cfg_attr(not(test), tracing::instrument(err, skip(self, backend)))] pub fn generate_credential_bundles( self, backend: &MlsCryptoProvider, diff --git a/crypto/src/mls/client/key_package.rs b/crypto/src/mls/client/key_package.rs index 854accefc..50790c97b 100644 --- a/crypto/src/mls/client/key_package.rs +++ b/crypto/src/mls/client/key_package.rs @@ -55,7 +55,6 @@ impl Client { /// /// # Errors /// KeyStore and OpenMls errors - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub async fn generate_one_keypackage_from_credential_bundle( &self, backend: &MlsCryptoProvider, @@ -93,7 +92,6 @@ impl Client { /// /// # Errors /// KeyStore and OpenMls errors - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub async fn request_key_packages( &self, count: usize, @@ -133,7 +131,6 @@ impl Client { Ok(kps) } - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub(crate) async fn generate_new_keypackages( &self, backend: &MlsCryptoProvider, @@ -154,7 +151,6 @@ impl Client { } /// Returns the count of valid, non-expired, unclaimed keypackages in store - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub async fn valid_keypackages_count( &self, backend: &MlsCryptoProvider, @@ -208,7 +204,6 @@ impl Client { Ok(()) } - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub(crate) async fn prune_keypackages_and_credential( &mut self, backend: &MlsCryptoProvider, @@ -251,7 +246,6 @@ impl Client { /// * HPKE private keys /// * HPKE Encryption KeyPairs /// * Signature KeyPairs & Credentials (use [Self::prune_keypackages_and_credential]) - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] async fn _prune_keypackages<'a>( &self, kps: &'a [(MlsKeyPackage, KeyPackage)], @@ -327,7 +321,6 @@ impl MlsCentral { /// /// # Errors /// Errors can happen when accessing the KeyStore - #[cfg_attr(not(test), tracing::instrument(err, skip(self)))] pub async fn get_or_create_client_keypackages( &self, ciphersuite: MlsCiphersuite, @@ -341,7 +334,6 @@ impl MlsCentral { /// Returns the count of valid, non-expired, unclaimed keypackages in store for the given [MlsCiphersuite] and [MlsCredentialType] #[cfg_attr(test, crate::idempotent)] - #[cfg_attr(not(test), tracing::instrument(err, skip(self)))] pub async fn client_valid_key_packages_count( &self, ciphersuite: MlsCiphersuite, @@ -355,7 +347,6 @@ impl MlsCentral { /// Prunes local KeyPackages after making sure they also have been deleted on the backend side /// You should only use this after [MlsCentral::e2ei_rotate_all] #[cfg_attr(test, crate::dispotent)] - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub async fn delete_keypackages(&mut self, refs: &[KeyPackageRef]) -> CryptoResult<()> { if refs.is_empty() { return Err(CryptoError::ConsumerError); diff --git a/crypto/src/mls/client/mod.rs b/crypto/src/mls/client/mod.rs index 54c25b287..0a00c82d9 100644 --- a/crypto/src/mls/client/mod.rs +++ b/crypto/src/mls/client/mod.rs @@ -28,6 +28,7 @@ use crate::{ }, }; use core_crypto_keystore::CryptoKeystoreError; +use log::debug; use openmls::prelude::{Credential, CredentialType}; use openmls_basic_credential::SignatureKeyPair; use openmls_traits::{crypto::OpenMlsCrypto, types::SignatureScheme, OpenMlsCryptoProvider}; @@ -37,7 +38,6 @@ use tls_codec::{Deserialize, Serialize}; use core_crypto_keystore::entities::{EntityBase, EntityFindParams, MlsCredential, MlsSignatureKeyPair}; use identities::ClientIdentities; use mls_crypto_provider::MlsCryptoProvider; -use tracing::{debug, Instrument}; impl MlsCentral { pub(crate) fn mls_client(&self) -> CryptoResult<&Client> { @@ -68,7 +68,6 @@ impl Client { /// /// # Errors /// KeyStore and OpenMls errors can happen - #[cfg_attr(not(test), tracing::instrument(err, skip(identifier, backend), fields(ciphersuites = ?ciphersuites)))] pub async fn init( identifier: ClientIdentifier, ciphersuites: &[MlsCiphersuite], @@ -80,7 +79,6 @@ impl Client { let credentials = backend .key_store() .find_all::(EntityFindParams::default()) - .in_current_span() .await?; let credentials = credentials @@ -100,13 +98,13 @@ impl Client { match Self::load(backend, id.as_ref(), credentials, signature_schemes).await { Ok(client) => client, Err(CryptoError::ClientSignatureNotFound) => { - debug!(nb_key_package, ciphersuites = ?ciphersuites, "Client signature not found. Generating client"); + debug!(count = nb_key_package, ciphersuites:? = ciphersuites; "Client signature not found. Generating client"); Self::generate(identifier, backend, ciphersuites, nb_key_package).await? } Err(e) => return Err(e), } } else { - debug!(nb_key_package, ciphersuites = ?ciphersuites, "Generating client"); + debug!(count = nb_key_package, ciphersuites:? = ciphersuites; "Generating client"); Self::generate(identifier, backend, ciphersuites, nb_key_package).await? }; @@ -122,7 +120,6 @@ impl Client { /// /// # Errors /// KeyStore and OpenMls errors can happen - #[cfg_attr(not(test), tracing::instrument(err, skip(backend), fields(ciphersuites = ?ciphersuites)))] pub async fn generate_raw_keypairs( ciphersuites: &[MlsCiphersuite], backend: &MlsCryptoProvider, @@ -278,7 +275,6 @@ impl Client { } /// Loads the client from the keystore. - #[cfg_attr(not(test), tracing::instrument(err, skip(backend, credentials), fields(id = %id)))] pub(crate) async fn load( backend: &MlsCryptoProvider, id: &ClientId, @@ -339,7 +335,6 @@ impl Client { }) } - #[cfg_attr(not(test), tracing::instrument(err, skip(backend)))] async fn find_all_basic_credentials(backend: &MlsCryptoProvider) -> CryptoResult> { let store_credentials = backend .key_store() @@ -358,7 +353,6 @@ impl Client { Ok(credentials) } - #[cfg_attr(not(test), tracing::instrument(err, skip(self, backend, cb), fields(id = id.as_ref().map(|id| id.to_string()))))] pub(crate) async fn save_identity( &mut self, backend: &MlsCryptoProvider, @@ -409,7 +403,6 @@ impl Client { .any(|(_, cred)| cred.credential().credential_type() == CredentialType::X509) } - #[cfg_attr(not(test), tracing::instrument(err, skip(self, backend)))] pub(crate) async fn get_most_recent_or_create_credential_bundle( &mut self, backend: &MlsCryptoProvider, @@ -418,9 +411,7 @@ impl Client { ) -> CryptoResult<&CredentialBundle> { match ct { MlsCredentialType::Basic => { - self.init_basic_credential_bundle_if_missing(backend, sc) - .in_current_span() - .await?; + self.init_basic_credential_bundle_if_missing(backend, sc).await?; self.find_most_recent_credential_bundle(sc, ct) .ok_or(CryptoError::CredentialNotFound(ct)) } @@ -430,7 +421,6 @@ impl Client { } } - #[cfg_attr(not(test), tracing::instrument(err, skip(self, backend)))] pub(crate) async fn init_basic_credential_bundle_if_missing( &mut self, backend: &MlsCryptoProvider, @@ -438,7 +428,7 @@ impl Client { ) -> CryptoResult<()> { let existing_cb = self.find_most_recent_credential_bundle(sc, MlsCredentialType::Basic); if existing_cb.is_none() { - debug!(id = %self.id(), "Initializing basic credential bundle"); + debug!(id:% = self.id(); "Initializing basic credential bundle"); let cb = Self::new_basic_credential_bundle(self.id(), sc, backend)?; self.save_identity(backend, None, sc, cb).await?; } diff --git a/crypto/src/mls/conversation/buffer_messages.rs b/crypto/src/mls/conversation/buffer_messages.rs index d8e109e56..4290fd68d 100644 --- a/crypto/src/mls/conversation/buffer_messages.rs +++ b/crypto/src/mls/conversation/buffer_messages.rs @@ -11,13 +11,12 @@ use crate::{ }, }; use core_crypto_keystore::entities::{EntityFindParams, MlsPendingMessage}; +use log::{error, info, trace}; use mls_crypto_provider::MlsCryptoProvider; use openmls::prelude::{MlsMessageIn, MlsMessageInBody}; use tls_codec::Deserialize; -use tracing::{error, span, trace, Instrument, Level}; impl MlsCentral { - #[cfg_attr(not(test), tracing::instrument(err, skip(self, message), fields(id = base64::Engine::encode(&base64::prelude::BASE64_STANDARD, id))))] pub(crate) async fn handle_future_message( &mut self, id: &ConversationId, @@ -33,7 +32,6 @@ impl MlsCentral { Err(CryptoError::BufferedFutureMessage) } - #[cfg_attr(not(test), tracing::instrument(err, skip(self, conversation)))] pub(crate) async fn restore_pending_messages( &mut self, conversation: &mut MlsConversation, @@ -68,7 +66,7 @@ impl MlsConversation { is_rejoin: bool, ) -> CryptoResult>> { // using the macro produces a clippy warning - let span = span!(target:module_path!(), Level::INFO, "restore_pending_messages"); + info!("restore_pending_messages"); let result = async move { let keystore = backend.borrow_keystore(); @@ -114,7 +112,6 @@ impl MlsConversation { let restore_pending = false; // to prevent infinite recursion let decrypted = self .decrypt_message(m, parent_conversation, client, backend, callbacks, restore_pending) - .in_current_span() .await?; decrypted_messages.push(decrypted.into()); } @@ -123,12 +120,11 @@ impl MlsConversation { Ok(decrypted_messages) } - .instrument(span) .await; match result { Ok(r) => Ok(r), Err(e) => { - error!(target:module_path!(), error = %e); + error!(error:% = e; "Error restoring pending messages"); Err(e) } } diff --git a/crypto/src/mls/conversation/commit.rs b/crypto/src/mls/conversation/commit.rs index 485825a31..fc3a982dc 100644 --- a/crypto/src/mls/conversation/commit.rs +++ b/crypto/src/mls/conversation/commit.rs @@ -17,7 +17,6 @@ use crate::{ }, prelude::{Client, ClientId, ConversationId, CryptoError, CryptoResult, MlsCentral, MlsError, MlsGroupInfoBundle}, }; -use tracing::Instrument; use super::MlsConversation; @@ -37,7 +36,6 @@ impl MlsCentral { /// If the authorisation callback is set, an error can be caused when the authorization fails. /// Other errors are KeyStore and OpenMls errors: #[cfg_attr(test, crate::idempotent)] - #[cfg_attr(not(test), tracing::instrument(err, skip(self, key_packages), fields(id = base64::Engine::encode(&base64::prelude::BASE64_STANDARD, id))))] pub async fn add_members_to_conversation( &mut self, id: &ConversationId, @@ -71,7 +69,6 @@ impl MlsCentral { /// # Errors /// If the authorisation callback is set, an error can be caused when the authorization fails. Other errors are KeyStore and OpenMls errors. #[cfg_attr(test, crate::idempotent)] - #[cfg_attr(not(test), tracing::instrument(err, skip(self), fields(id = base64::Engine::encode(&base64::prelude::BASE64_STANDARD, id))))] pub async fn remove_members_from_conversation( &mut self, id: &ConversationId, @@ -105,7 +102,6 @@ impl MlsCentral { /// If the conversation can't be found, an error will be returned. Other errors are originating /// from OpenMls and the KeyStore #[cfg_attr(test, crate::idempotent)] - #[cfg_attr(not(test), tracing::instrument(err, skip(self), fields(id = base64::Engine::encode(&base64::prelude::BASE64_STANDARD, id))))] pub async fn update_keying_material(&mut self, id: &ConversationId) -> CryptoResult { self.get_conversation(id) .await? @@ -126,7 +122,6 @@ impl MlsCentral { /// # Errors /// Errors can be originating from the KeyStore and OpenMls #[cfg_attr(test, crate::idempotent)] - #[cfg_attr(not(test), tracing::instrument(err, skip(self), fields(id = base64::Engine::encode(&base64::prelude::BASE64_STANDARD, id))))] pub async fn commit_pending_proposals(&mut self, id: &ConversationId) -> CryptoResult> { self.get_conversation(id) .await? @@ -142,7 +137,6 @@ impl MlsConversation { /// see [MlsCentral::add_members_to_conversation] /// Note: this is not exposed publicly because authorization isn't handled at this level #[cfg_attr(test, crate::durable)] - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub(crate) async fn add_members( &mut self, client: &Client, @@ -171,7 +165,6 @@ impl MlsConversation { let (commit, welcome, gi) = self .group .add_members(backend, signer, key_packages) - .in_current_span() .await .map_err(MlsError::from)?; @@ -192,7 +185,6 @@ impl MlsConversation { /// see [MlsCentral::remove_members_from_conversation] /// Note: this is not exposed publicly because authorization isn't handled at this level #[cfg_attr(test, crate::durable)] - #[cfg_attr(not(test), tracing::instrument(err, skip(self, client, backend)))] pub(crate) async fn remove_members( &mut self, client: &Client, @@ -220,7 +212,6 @@ impl MlsConversation { let (commit, welcome, gi) = self .group .remove_members(backend, signer, &member_kps) - .in_current_span() .await .map_err(MlsError::from)?; @@ -239,7 +230,6 @@ impl MlsConversation { /// see [MlsCentral::update_keying_material] #[cfg_attr(test, crate::durable)] - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub(crate) async fn update_keying_material( &mut self, client: &Client, @@ -253,7 +243,6 @@ impl MlsConversation { let (commit, welcome, group_info) = self .group .explicit_self_update(backend, &cb.signature_key, leaf_node) - .in_current_span() .await .map_err(MlsError::from)?; @@ -272,7 +261,6 @@ impl MlsConversation { /// see [MlsCentral::commit_pending_proposals] #[cfg_attr(test, crate::durable)] - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub(crate) async fn commit_pending_proposals( &mut self, client: &Client, @@ -287,7 +275,6 @@ impl MlsConversation { let (commit, welcome, gi) = self .group .commit_to_pending_proposals(backend, signer) - .in_current_span() .await .map_err(MlsError::from)?; let group_info = MlsGroupInfoBundle::try_new_full_plaintext(gi.unwrap())?; diff --git a/crypto/src/mls/conversation/commit_delay.rs b/crypto/src/mls/conversation/commit_delay.rs index 88ec19c1d..85e726d63 100644 --- a/crypto/src/mls/conversation/commit_delay.rs +++ b/crypto/src/mls/conversation/commit_delay.rs @@ -1,8 +1,8 @@ +use log::{debug, trace}; use openmls::prelude::LeafNodeIndex; use super::MlsConversation; use crate::MlsError; -use tracing::{debug, trace}; /// These constants intend to ramp up the delay and flatten the curve for later positions const DELAY_RAMP_UP_MULTIPLIER: f32 = 120.0; @@ -16,7 +16,6 @@ impl MlsConversation { /// * `self_index` - ratchet tree index of self client /// * `epoch` - current group epoch /// * `nb_members` - number of clients in the group - #[cfg_attr(not(test), tracing::instrument(skip(self), ret))] pub fn compute_next_commit_delay(&self) -> Option { use openmls::messages::proposals::Proposal; @@ -34,7 +33,7 @@ impl MlsConversation { .collect::>(); let self_index = self.group.own_leaf_index(); - debug!(removed_index = ?removed_index, self_index = ?self_index, "Indexes"); + debug!(removed_index:? = removed_index, self_index:? = self_index; "Indexes"); // Find a remove proposal that concerns us let is_self_removed = removed_index.iter().any(|&i| i == self_index); diff --git a/crypto/src/mls/conversation/decrypt.rs b/crypto/src/mls/conversation/decrypt.rs index fa38d3da5..ae7c8dafd 100644 --- a/crypto/src/mls/conversation/decrypt.rs +++ b/crypto/src/mls/conversation/decrypt.rs @@ -275,7 +275,6 @@ impl MlsConversation { Ok(decrypted) } - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] async fn parse_message( &mut self, backend: &MlsCryptoProvider, @@ -339,7 +338,6 @@ impl MlsConversation { Ok(processed_msg) } - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] async fn validate_commit(&self, commit: &StagedCommit, backend: &MlsCryptoProvider) -> CryptoResult<()> { if backend.authentication_service().is_env_setup().await { let credentials: Vec<_> = commit @@ -382,7 +380,6 @@ impl MlsCentral { /// # Errors /// If the conversation can't be found, an error will be returned. Other errors are originating /// from OpenMls and the KeyStore - #[cfg_attr(not(test), tracing::instrument(err, skip(self, message), fields(id = base64::Engine::encode(&base64::prelude::BASE64_STANDARD, id))))] pub async fn decrypt_message( &mut self, id: &ConversationId, diff --git a/crypto/src/mls/conversation/duplicate.rs b/crypto/src/mls/conversation/duplicate.rs index 5c4647400..acdcac667 100644 --- a/crypto/src/mls/conversation/duplicate.rs +++ b/crypto/src/mls/conversation/duplicate.rs @@ -8,7 +8,6 @@ use mls_crypto_provider::MlsCryptoProvider; use openmls::prelude::{ContentType, FramedContentBodyIn, Proposal, PublicMessageIn, Sender}; impl MlsConversation { - #[cfg_attr(not(test), tracing::instrument(err, ret, skip_all))] pub(crate) fn is_duplicate_message( &self, backend: &MlsCryptoProvider, diff --git a/crypto/src/mls/conversation/encrypt.rs b/crypto/src/mls/conversation/encrypt.rs index ae54fe539..269074e28 100644 --- a/crypto/src/mls/conversation/encrypt.rs +++ b/crypto/src/mls/conversation/encrypt.rs @@ -7,10 +7,10 @@ //! | 0 pend. Proposal | ✅ | ❌ | //! | 1+ pend. Proposal | ❌ | ❌ | -use mls_crypto_provider::MlsCryptoProvider; -use openmls::prelude::MlsMessageOutBody; use crate::prelude::Client; use crate::{mls::ConversationId, mls::MlsCentral, CryptoError, CryptoResult, MlsError}; +use mls_crypto_provider::MlsCryptoProvider; +use openmls::prelude::MlsMessageOutBody; use super::MlsConversation; @@ -19,7 +19,6 @@ impl MlsConversation { /// see [MlsCentral::encrypt_message] /// It is durable because encrypting increments the message generation #[cfg_attr(test, crate::durable)] - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub async fn encrypt_message( &mut self, client: &Client, @@ -59,7 +58,6 @@ impl MlsCentral { /// If the conversation can't be found, an error will be returned. Other errors are originating /// from OpenMls and the KeyStore #[cfg_attr(test, crate::idempotent)] - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub async fn encrypt_message( &mut self, conversation: &ConversationId, diff --git a/crypto/src/mls/conversation/merge.rs b/crypto/src/mls/conversation/merge.rs index f3179af09..6dbdc9479 100644 --- a/crypto/src/mls/conversation/merge.rs +++ b/crypto/src/mls/conversation/merge.rs @@ -27,7 +27,6 @@ use crate::{ impl MlsConversation { /// see [MlsCentral::commit_accepted] #[cfg_attr(test, crate::durable)] - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub async fn commit_accepted(&mut self, backend: &MlsCryptoProvider) -> CryptoResult<()> { // openmls stores here all the encryption keypairs used for update proposals.. let previous_own_leaf_nodes = self.group.own_leaf_nodes.clone(); @@ -46,7 +45,6 @@ impl MlsConversation { /// see [MlsCentral::clear_pending_proposal] #[cfg_attr(test, crate::durable)] - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub async fn clear_pending_proposal( &mut self, proposal_ref: MlsProposalRef, @@ -65,7 +63,6 @@ impl MlsConversation { /// see [MlsCentral::clear_pending_commit] #[cfg_attr(test, crate::durable)] - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub async fn clear_pending_commit(&mut self, backend: &MlsCryptoProvider) -> CryptoResult<()> { if self.group.pending_commit().is_some() { self.group.clear_pending_commit(); @@ -94,7 +91,6 @@ impl MlsCentral { /// to be used for the new epoch. /// We can now safely "merge" it (effectively apply the commit to the group) and update it /// in the keystore. The previous can be discarded to respect Forward Secrecy. - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub async fn commit_accepted( &mut self, id: &ConversationId, @@ -118,13 +114,12 @@ impl MlsCentral { /// /// # Arguments /// * `conversation_id` - the group/conversation id - /// * `proposal_ref` - unique proposal identifier which is present in [crate::prelude::MlsProposalBundle] and - /// returned from all operation creating a proposal + /// * `proposal_ref` - unique proposal identifier which is present in [crate::prelude::MlsProposalBundle] + /// and returned from all operation creating a proposal /// /// # Errors /// When the conversation is not found or the proposal reference does not identify a proposal /// in the local pending proposal store - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub async fn clear_pending_proposal( &mut self, conversation_id: &ConversationId, @@ -152,7 +147,6 @@ impl MlsCentral { /// # Errors /// When the conversation is not found or there is no pending commit #[cfg_attr(test, crate::idempotent)] - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub async fn clear_pending_commit(&mut self, conversation_id: &ConversationId) -> CryptoResult<()> { self.get_conversation(conversation_id) .await? diff --git a/crypto/src/mls/conversation/mod.rs b/crypto/src/mls/conversation/mod.rs index abdafe980..bfcdc5930 100644 --- a/crypto/src/mls/conversation/mod.rs +++ b/crypto/src/mls/conversation/mod.rs @@ -93,7 +93,6 @@ impl MlsConversation { /// /// # Errors /// Errors can happen from OpenMls or from the KeyStore - #[cfg_attr(not(test), tracing::instrument(err, skip(author_client, configuration, backend, creator_credential_type), fields(id = base64::Engine::encode(&base64::prelude::BASE64_STANDARD, &id))))] pub async fn create( id: ConversationId, author_client: &mut Client, @@ -129,7 +128,6 @@ impl MlsConversation { } /// Internal API: create a group from an existing conversation. For example by external commit - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub(crate) async fn from_mls_group( group: MlsGroup, configuration: MlsConversationConfiguration, @@ -150,7 +148,6 @@ impl MlsConversation { } /// Internal API: restore the conversation from a persistence-saved serialized Group State. - #[cfg_attr(not(test), tracing::instrument(err, skip(buf), fields(id = parent_id.as_ref().map(|id| base64::Engine::encode(&base64::prelude::BASE64_STANDARD, id)))))] pub(crate) fn from_serialized_state(buf: Vec, parent_id: Option) -> CryptoResult { let group: MlsGroup = core_crypto_keystore::deser(&buf)?; let id = ConversationId::from(group.group_id().as_slice()); @@ -221,7 +218,6 @@ impl MlsConversation { /// Marks this conversation as child of another. /// Prequisite: Being a member of this group and for it to be stored in the keystore - #[cfg_attr(not(test), tracing::instrument(err, skip(self, backend), fields(parent_id = base64::Engine::encode(&base64::prelude::BASE64_STANDARD, parent_id))))] pub async fn mark_as_child_of( &mut self, parent_id: &ConversationId, @@ -267,7 +263,6 @@ impl MlsCentral { .ok_or_else(|| CryptoError::ConversationNotFound(id.clone())) } - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub(crate) async fn get_parent_conversation( &mut self, conversation: &GroupStoreValue, @@ -294,7 +289,6 @@ impl MlsCentral { /// Mark a conversation as child of another one /// This will affect the behavior of callbacks in particular #[cfg_attr(test, crate::idempotent)] - #[cfg_attr(not(test), tracing::instrument(err, skip(self), fields(parent_id = base64::Engine::encode(&base64::prelude::BASE64_STANDARD, parent_id), child_id = base64::Engine::encode(&base64::prelude::BASE64_STANDARD, child_id))))] pub async fn mark_conversation_as_child_of( &mut self, child_id: &ConversationId, diff --git a/crypto/src/mls/conversation/own_commit.rs b/crypto/src/mls/conversation/own_commit.rs index 0b145e26b..df6580f19 100644 --- a/crypto/src/mls/conversation/own_commit.rs +++ b/crypto/src/mls/conversation/own_commit.rs @@ -49,7 +49,6 @@ impl MlsConversation { } } - #[cfg_attr(not(test), tracing::instrument(skip_all, err))] pub(crate) async fn handle_own_commit<'a>( &mut self, backend: &MlsCryptoProvider, diff --git a/crypto/src/mls/conversation/proposal.rs b/crypto/src/mls/conversation/proposal.rs index 516d7569f..0c01b5ce2 100644 --- a/crypto/src/mls/conversation/proposal.rs +++ b/crypto/src/mls/conversation/proposal.rs @@ -22,7 +22,6 @@ use crate::{ impl MlsConversation { /// see [openmls::group::MlsGroup::propose_add_member] #[cfg_attr(test, crate::durable)] - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub async fn propose_add_member( &mut self, client: &Client, @@ -56,7 +55,6 @@ impl MlsConversation { /// see [openmls::group::MlsGroup::propose_remove_member] #[cfg_attr(test, crate::durable)] - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub async fn propose_remove_member( &mut self, client: &Client, @@ -79,7 +77,6 @@ impl MlsConversation { /// see [openmls::group::MlsGroup::propose_self_update] #[cfg_attr(test, crate::durable)] - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub async fn propose_self_update( &mut self, client: &Client, @@ -90,7 +87,6 @@ impl MlsConversation { /// see [openmls::group::MlsGroup::propose_self_update] #[cfg_attr(test, crate::durable)] - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub async fn propose_explicit_self_update( &mut self, client: &Client, diff --git a/crypto/src/mls/conversation/renew.rs b/crypto/src/mls/conversation/renew.rs index 02c9ea556..1e0b34909 100644 --- a/crypto/src/mls/conversation/renew.rs +++ b/crypto/src/mls/conversation/renew.rs @@ -22,7 +22,6 @@ impl Renew { /// * `pending_proposals` - local pending proposals in group's proposal store /// * `pending_commit` - local pending commit which is now invalid /// * `valid_commit` - commit accepted by the backend which will now supersede our local pending commit - #[cfg_attr(not(test), tracing::instrument(skip_all))] pub(crate) fn renew<'a>( self_index: &LeafNodeIndex, pending_proposals: impl Iterator + 'a, @@ -96,7 +95,6 @@ impl Renew { impl MlsConversation { /// Given the proposals to renew, actually restore them by using associated methods in [MlsGroup]. /// This will also add them to the local proposal store - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub(crate) async fn renew_proposals_for_current_epoch( &mut self, client: &Client, @@ -126,7 +124,6 @@ impl MlsConversation { /// Renews an update proposal by considering the explicit LeafNode supplied in the proposal /// by applying it to the current own LeafNode. /// At this point, we have already verified we are only operating on proposals created by self. - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] async fn renew_update( &mut self, client: &Client, diff --git a/crypto/src/mls/conversation/welcome.rs b/crypto/src/mls/conversation/welcome.rs index 2f612c481..bbd45d90a 100644 --- a/crypto/src/mls/conversation/welcome.rs +++ b/crypto/src/mls/conversation/welcome.rs @@ -35,7 +35,6 @@ impl MlsCentral { /// # Errors /// see [MlsCentral::process_welcome_message] #[cfg_attr(test, crate::dispotent)] - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub async fn process_raw_welcome_message( &mut self, welcome: Vec, @@ -60,7 +59,6 @@ impl MlsCentral { /// * if no [openmls::key_packages::KeyPackage] can be read from the KeyStore /// * if the message can't be decrypted #[cfg_attr(test, crate::dispotent)] - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub async fn process_welcome_message( &mut self, welcome: MlsMessageIn, @@ -106,7 +104,6 @@ impl MlsConversation { /// /// # Errors /// Errors can happen from OpenMls or from the KeyStore - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] async fn from_welcome_message( welcome: Welcome, configuration: MlsConversationConfiguration, diff --git a/crypto/src/mls/conversation/wipe.rs b/crypto/src/mls/conversation/wipe.rs index e1ed6f9a4..8e95c5028 100644 --- a/crypto/src/mls/conversation/wipe.rs +++ b/crypto/src/mls/conversation/wipe.rs @@ -9,7 +9,6 @@ impl MlsCentral { /// # Errors /// KeyStore errors, such as IO #[cfg_attr(test, crate::dispotent)] - #[cfg_attr(not(test), tracing::instrument(err, skip(self), fields(id = base64::Engine::encode(&base64::prelude::BASE64_STANDARD, id))))] pub async fn wipe_conversation(&mut self, id: &ConversationId) -> CryptoResult<()> { self.get_conversation(id) .await? @@ -24,7 +23,6 @@ impl MlsCentral { } impl MlsConversation { - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] async fn wipe_associated_entities(&mut self, backend: &MlsCryptoProvider) -> CryptoResult<()> { // the own client may or may not have generated an epoch keypair in the previous epoch // Since it is a terminal operation, ignoring the error is fine here. diff --git a/crypto/src/mls/credential/crl.rs b/crypto/src/mls/credential/crl.rs index 35014eaf2..8eb9db3b3 100644 --- a/crypto/src/mls/credential/crl.rs +++ b/crypto/src/mls/credential/crl.rs @@ -11,7 +11,6 @@ use openmls_traits::OpenMlsCryptoProvider; use std::collections::HashSet; use wire_e2e_identity::prelude::x509::extract_crl_uris; -#[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub(crate) fn extract_crl_uris_from_credentials<'a>( mut credentials: impl Iterator, ) -> CryptoResult> { @@ -24,7 +23,6 @@ pub(crate) fn extract_crl_uris_from_credentials<'a>( }) } -#[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub(crate) fn extract_crl_uris_from_proposals(proposals: &[Proposal]) -> CryptoResult> { extract_crl_uris_from_credentials( proposals @@ -67,7 +65,6 @@ pub(crate) fn extract_dp(cert: &Certificate) -> CryptoResult> { .collect()) } -#[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub(crate) async fn get_new_crl_distribution_points( backend: &MlsCryptoProvider, mut crl_dps: HashSet, @@ -86,7 +83,6 @@ pub(crate) async fn get_new_crl_distribution_points( impl MlsCentral { /// When x509 new credentials are registered this extracts the new CRL Distribution Point from the end entity certificate /// and all the intermediates - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub(crate) async fn extract_dp_on_init( &mut self, certificate_chain: &[Vec], diff --git a/crypto/src/mls/credential/mod.rs b/crypto/src/mls/credential/mod.rs index d7a27d06e..774a1fdad 100644 --- a/crypto/src/mls/credential/mod.rs +++ b/crypto/src/mls/credential/mod.rs @@ -101,7 +101,6 @@ impl PartialOrd for CredentialBundle { } impl Client { - #[cfg_attr(not(test), cfg_attr(not(test), tracing::instrument(err, skip(backend), fields(id = %id))))] pub(crate) fn new_basic_credential_bundle( id: &ClientId, sc: SignatureScheme, diff --git a/crypto/src/mls/external_commit.rs b/crypto/src/mls/external_commit.rs index 8e9f61fe5..8d2f497d1 100644 --- a/crypto/src/mls/external_commit.rs +++ b/crypto/src/mls/external_commit.rs @@ -20,7 +20,6 @@ use openmls::prelude::{ }; use openmls_traits::OpenMlsCryptoProvider; use tls_codec::Serialize; -use tracing::Instrument; use core_crypto_keystore::{ entities::{MlsPendingMessage, PersistedMlsPendingGroup}, @@ -76,13 +75,12 @@ impl MlsCentral { /// bad can happen if you forget to except some storage space wasted. /// /// # Arguments - /// * `group_info` - a GroupInfo wrapped in a MLS message. it can be obtained by deserializing a TLS - /// serialized `GroupInfo` object + /// * `group_info` - a GroupInfo wrapped in a MLS message. it can be obtained by deserializing a TLS serialized `GroupInfo` object /// * `custom_cfg` - configuration of the MLS conversation fetched from the Delivery Service /// * `credential_type` - kind of [openmls::prelude::Credential] to use for joining this group. - /// If [MlsCredentialType::Basic] is chosen and no Credential has been created yet for it, - /// a new one will be generated. When [MlsCredentialType::X509] is chosen, it fails when no - /// [openmls::prelude::Credential] has been created for the given Ciphersuite. + /// If [MlsCredentialType::Basic] is chosen and no Credential has been created yet for it, + /// a new one will be generated. When [MlsCredentialType::X509] is chosen, it fails when no + /// [openmls::prelude::Credential] has been created for the given Ciphersuite. /// /// # Return type /// It will return a tuple with the group/conversation id and the message containing the @@ -90,7 +88,6 @@ impl MlsCentral { /// /// # Errors /// Errors resulting from OpenMls, the KeyStore calls and serialization - #[cfg_attr(not(test), tracing::instrument(err, skip(self, group_info, custom_cfg)))] pub async fn join_by_external_commit( &mut self, group_info: VerifiableGroupInfo, @@ -121,7 +118,6 @@ impl MlsCentral { &[], cb.to_mls_credential_with_key(), ) - .in_current_span() .await .map_err(MlsError::from)?; @@ -159,7 +155,6 @@ impl MlsCentral { /// # Errors /// Errors resulting from OpenMls, the KeyStore calls and deserialization #[cfg_attr(test, crate::dispotent)] - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub async fn merge_pending_group_from_external_commit( &mut self, id: &ConversationId, @@ -229,7 +224,6 @@ impl MlsCentral { } impl MlsConversation { - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub(crate) async fn validate_external_commit( &self, commit: &StagedCommit, @@ -267,7 +261,6 @@ impl MlsConversation { existing_clients.clone(), parent_clients, ) - .in_current_span() .await { return Err(CryptoError::UnauthorizedExternalCommit); @@ -276,7 +269,6 @@ impl MlsConversation { // to perform such operation if !callbacks .user_authorize(self.id.clone(), sender, existing_clients) - .in_current_span() .await { return Err(CryptoError::UnauthorizedExternalCommit); diff --git a/crypto/src/mls/external_proposal.rs b/crypto/src/mls/external_proposal.rs index 76ed03ab6..7ba6a0836 100644 --- a/crypto/src/mls/external_proposal.rs +++ b/crypto/src/mls/external_proposal.rs @@ -1,21 +1,19 @@ -use std::collections::HashSet; - +use log::{trace, warn}; use openmls::{ group::QueuedProposal, prelude::{GroupEpoch, GroupId, JoinProposal, LeafNodeIndex, MlsMessageOut, Proposal, Sender}, }; +use std::collections::HashSet; use crate::{ group_store::GroupStoreValue, mls::{credential::typ::MlsCredentialType, ClientId, ConversationId, MlsCentral}, prelude::{CoreCryptoCallbacks, CryptoError, CryptoResult, MlsCiphersuite, MlsConversation, MlsError}, }; -use tracing::{trace, warn, Instrument}; impl MlsConversation { /// Validates the proposal. If it is external and an `Add` proposal it will call the callback /// interface to validate the proposal, otherwise it will succeed. - #[cfg_attr(not(test), tracing::instrument(err, skip_all))] pub(crate) async fn validate_external_proposal( &self, proposal: &QueuedProposal, @@ -60,7 +58,6 @@ impl MlsConversation { } /// Get actual group members and subtract pending remove proposals - #[cfg_attr(not(test), tracing::instrument(skip(self)))] pub fn members_in_next_epoch(&self) -> Vec { let pending_removals = self.pending_removals(); let existing_clients = self @@ -70,7 +67,7 @@ impl MlsConversation { if !pending_removals.contains(&kp.index) { Some(kp.credential.identity().into()) } else { - trace!(client_index = %kp.index, "Client is pending removal"); + trace!(client_index:% = kp.index; "Client is pending removal"); None } }) @@ -108,7 +105,6 @@ impl MlsCentral { /// Fails when `credential_type` is [MlsCredentialType::X509] and no Credential has been created /// for it beforehand with [MlsCentral::e2ei_mls_init_only] or variants. #[cfg_attr(test, crate::dispotent)] - #[cfg_attr(not(test), tracing::instrument(err, skip(self)))] pub async fn new_external_add_proposal( &mut self, conversation_id: ConversationId, @@ -140,7 +136,6 @@ impl MlsCentral { let kp = self .mls_client()? .generate_one_keypackage_from_credential_bundle(&self.mls_backend, ciphersuite, cb) - .in_current_span() .await?; Ok(JoinProposal::new(kp, group_id, epoch, &cb.signature_key).map_err(MlsError::from)?) diff --git a/crypto/src/mls/mod.rs b/crypto/src/mls/mod.rs index 42be41bed..1838fdf11 100644 --- a/crypto/src/mls/mod.rs +++ b/crypto/src/mls/mod.rs @@ -1,5 +1,4 @@ -use tracing::{trace, Instrument}; - +use log::trace; use mls_crypto_provider::{MlsCryptoProvider, MlsCryptoProviderConfiguration}; use openmls_traits::OpenMlsCryptoProvider; @@ -80,7 +79,6 @@ pub(crate) mod config { /// ); /// assert!(result.is_ok()); /// ``` - #[cfg_attr(not(test), tracing::instrument(skip_all, fields(store_path, ciphersuites = ?ciphersuites, client_id = client_id.as_ref().map(|id| base64::Engine::encode::<&[u8]>(&base64::prelude::BASE64_STANDARD, id))), err))] pub fn try_new( store_path: String, identity_key: String, @@ -160,8 +158,7 @@ impl MlsCentral { /// can be caused by group deserialization or during the initialization of the credentials: /// * for x509 Credentials if the cetificate chain length is lower than 2 /// * for Basic Credentials if the signature key cannot be generated either by not supported - /// scheme or the key generation fails - #[cfg_attr(not(test), tracing::instrument(skip_all, err))] + /// scheme or the key generation fails pub async fn try_new(configuration: MlsCentralConfiguration) -> CryptoResult { // Init backend (crypto + rand + keystore) let mls_backend = MlsCryptoProvider::try_new_with_configuration(MlsCryptoProviderConfiguration { @@ -170,7 +167,6 @@ impl MlsCentral { in_memory: false, entropy_seed: configuration.external_entropy, }) - .in_current_span() .await?; let mls_client = if let Some(id) = configuration.client_id { // Init client identity (load or create) @@ -200,13 +196,12 @@ impl MlsCentral { callbacks: None, }; - central.init_pki_env().in_current_span().await?; + central.init_pki_env().await?; Ok(central) } /// Same as the [MlsCentral::try_new] but instead, it uses an in memory KeyStore. Although required, the `store_path` parameter from the `MlsCentralConfiguration` won't be used here. - #[cfg_attr(not(test), tracing::instrument(skip_all, err))] pub async fn try_new_in_memory(configuration: MlsCentralConfiguration) -> CryptoResult { let mls_backend = MlsCryptoProvider::try_new_with_configuration(MlsCryptoProviderConfiguration { db_path: &configuration.store_path, @@ -214,7 +209,6 @@ impl MlsCentral { in_memory: true, entropy_seed: configuration.external_entropy, }) - .in_current_span() .await?; let mls_client = if let Some(id) = configuration.client_id { Some( @@ -240,7 +234,7 @@ impl MlsCentral { callbacks: None, }; - central.init_pki_env().in_current_span().await?; + central.init_pki_env().await?; Ok(central) } @@ -248,7 +242,6 @@ impl MlsCentral { /// Initializes the MLS client if [super::CoreCrypto] has previously been initialized with /// `CoreCrypto::deferred_init` instead of `CoreCrypto::new`. /// This should stay as long as proteus is supported. Then it should be removed. - #[cfg_attr(not(test), tracing::instrument(err, skip(self, identifier), fields(ciphersuites = ?ciphersuites)))] pub async fn mls_init( &mut self, identifier: ClientIdentifier, @@ -263,8 +256,8 @@ impl MlsCentral { let mls_client = Client::init(identifier, &ciphersuites, &self.mls_backend, nb_key_package).await?; if mls_client.is_e2ei_capable() { - trace!(client_id = %mls_client.id(),"Initializing PKI environment"); - self.init_pki_env().in_current_span().await?; + trace!(client_id:% = mls_client.id(); "Initializing PKI environment"); + self.init_pki_env().await?; } self.mls_client.replace(mls_client); @@ -290,7 +283,6 @@ impl MlsCentral { /// /// Important: This is designed to be called after [MlsCentral::mls_generate_keypairs] #[cfg_attr(test, crate::dispotent)] - #[cfg_attr(not(test), tracing::instrument(err, skip(self), fields(ciphersuites = ?ciphersuites, client_id = ?client_id, tmp_client_ids = ?tmp_client_ids)))] pub async fn mls_init_with_client_id( &mut self, client_id: ClientId, @@ -344,7 +336,7 @@ impl MlsCentral { /// /// # Arguments /// * `id` - identifier of the group/conversation (must be unique otherwise the existing group - /// will be overridden) + /// will be overridden) /// * `creator_credential_type` - kind of credential the creator wants to create the group with /// * `config` - configuration of the group/conversation /// @@ -352,7 +344,6 @@ impl MlsCentral { /// Errors can happen from the KeyStore or from OpenMls for ex if no [openmls::key_packages::KeyPackage] can /// be found in the KeyStore #[cfg_attr(test, crate::dispotent)] - #[cfg_attr(not(test), tracing::instrument(err, skip(self, config), fields(id = base64::Engine::encode(&base64::prelude::BASE64_STANDARD, id))))] pub async fn new_conversation( &mut self, id: &ConversationId, @@ -371,7 +362,6 @@ impl MlsCentral { config, &self.mls_backend, ) - .in_current_span() .await?; self.mls_groups.insert(id.clone(), conversation); diff --git a/crypto/src/mls/proposal.rs b/crypto/src/mls/proposal.rs index 5a67e38e7..f9cad46a5 100644 --- a/crypto/src/mls/proposal.rs +++ b/crypto/src/mls/proposal.rs @@ -132,7 +132,6 @@ impl MlsCentral { /// # Errors /// If the conversation is not found, an error will be returned. Errors from OpenMls can be /// returned as well, when for example there's a commit pending to be merged - #[cfg_attr(not(test), tracing::instrument(err, skip(self, proposal), fields(id = base64::Engine::encode(&base64::prelude::BASE64_STANDARD, id))))] async fn new_proposal(&mut self, id: &ConversationId, proposal: MlsProposal) -> CryptoResult { let conversation = self.get_conversation(id).await?; let client = self.mls_client()?; diff --git a/crypto/src/mls/restore.rs b/crypto/src/mls/restore.rs index 85c830055..b08257cb3 100644 --- a/crypto/src/mls/restore.rs +++ b/crypto/src/mls/restore.rs @@ -1,9 +1,9 @@ use crate::prelude::{MlsCentral, MlsConversation}; use crate::CryptoResult; use base64::{prelude::BASE64_STANDARD, Engine}; +use log::{error, info}; use mls_crypto_provider::MlsCryptoProvider; use openmls_traits::OpenMlsCryptoProvider; -use tracing::{error, info, Instrument}; impl MlsCentral { /// [MlsCentral] is supposed to be a singleton. Knowing that, it does some optimizations by @@ -12,16 +12,14 @@ impl MlsCentral { /// [MlsCentral] instance has to be used. This method has to be used to synchronize instances. /// It simply fetches the MLS group from keystore in memory. #[cfg_attr(test, crate::idempotent)] - #[cfg_attr(not(test), tracing::instrument(skip(self), err))] pub async fn restore_from_disk(&mut self) -> CryptoResult<()> { self.mls_groups = Self::restore_groups(&self.mls_backend).await?; - self.init_pki_env().in_current_span().await?; + self.init_pki_env().await?; Ok(()) } /// Restore existing groups from the KeyStore. - #[cfg_attr(not(test), tracing::instrument(skip(backend), err))] pub(crate) async fn restore_groups( backend: &MlsCryptoProvider, ) -> CryptoResult> { @@ -38,9 +36,9 @@ impl MlsCentral { for (group_id, (parent_id, state)) in groups.into_iter() { let conversation = MlsConversation::from_serialized_state(state, parent_id)?; let encoded_id = BASE64_STANDARD.encode(&group_id); - info!(group_id = encoded_id, "Restored group"); + info!(group_id:% = encoded_id; "Restored group"); if group_store.try_insert(group_id, conversation).is_err() { - error!(group_id = encoded_id, "Failed to insert group into store"); + error!(group_id:% = encoded_id; "Failed to insert group into store"); break; } }