From 0e51c34de69469b86182b1defe136516f2b39b65 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Thu, 29 Aug 2024 13:43:24 -0700 Subject: [PATCH 1/6] Store or ignore group messages (#1019) --- xmtp_mls/src/groups/sync.rs | 10 +++++----- xmtp_mls/src/storage/encrypted_store/group_message.rs | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/xmtp_mls/src/groups/sync.rs b/xmtp_mls/src/groups/sync.rs index ccd1f10b4..6f81c4eaa 100644 --- a/xmtp_mls/src/groups/sync.rs +++ b/xmtp_mls/src/groups/sync.rs @@ -38,7 +38,7 @@ use crate::{ }, utils::{hash::sha256, id::calculate_message_id}, xmtp_openmls_provider::XmtpOpenMlsProvider, - Client, Delete, Fetch, Store, XmtpApi, + Client, Delete, Fetch, StoreOrIgnore, XmtpApi, }; use futures::future::try_join_all; use log::debug; @@ -411,7 +411,7 @@ impl MlsGroup { sender_inbox_id, delivery_status: DeliveryStatus::Published, } - .store(provider.conn_ref())? + .store_or_ignore(provider.conn_ref())? } Some(Content::V2(V2 { idempotency_key, @@ -438,7 +438,7 @@ impl MlsGroup { sender_inbox_id: sender_inbox_id.clone(), delivery_status: DeliveryStatus::Published, } - .store(provider.conn_ref())?; + .store_or_ignore(provider.conn_ref())?; } Some(Reply(history_reply)) => { let content: MessageHistoryContent = @@ -461,7 +461,7 @@ impl MlsGroup { sender_inbox_id, delivery_status: DeliveryStatus::Published, } - .store(provider.conn_ref())?; + .store_or_ignore(provider.conn_ref())?; } _ => { return Err(MessageProcessingError::InvalidPayload); @@ -725,7 +725,7 @@ impl MlsGroup { delivery_status: DeliveryStatus::Published, }; - msg.store(conn)?; + msg.store_or_ignore(conn)?; Ok(Some(msg)) } diff --git a/xmtp_mls/src/storage/encrypted_store/group_message.rs b/xmtp_mls/src/storage/encrypted_store/group_message.rs index da994db55..b6436c75e 100644 --- a/xmtp_mls/src/storage/encrypted_store/group_message.rs +++ b/xmtp_mls/src/storage/encrypted_store/group_message.rs @@ -13,7 +13,7 @@ use super::{ db_connection::DbConnection, schema::{group_messages, group_messages::dsl}, }; -use crate::{impl_fetch, impl_store, StorageError}; +use crate::{impl_fetch, impl_store, impl_store_or_ignore, StorageError}; #[derive( Debug, Clone, Serialize, Deserialize, Insertable, Identifiable, Queryable, Eq, PartialEq, @@ -106,6 +106,7 @@ where impl_fetch!(StoredGroupMessage, group_messages, Vec); impl_store!(StoredGroupMessage, group_messages); +impl_store_or_ignore!(StoredGroupMessage, group_messages); impl DbConnection { /// Query for group messages From e6e8cab1b054d80952fa4df932a8658c1067b3e7 Mon Sep 17 00:00:00 2001 From: Cameron Voell <1103838+cameronvoell@users.noreply.github.com> Date: Thu, 29 Aug 2024 14:53:27 -0700 Subject: [PATCH 2/6] Fix send update interval ns calculation, move to configuration (#1008) * fix send update interval ns calculation, move to configuration * lint fix * add delay so send msg syncs installations * add constant to tests so they follow the libxmtp configuration * fmt fix * directly update installations instead of sleeping delay interval in bindings test --------- Co-authored-by: cameronvoell --- bindings_ffi/src/mls.rs | 29 ++++++++++++++++++++++++++++- xmtp_mls/src/configuration.rs | 8 ++++++-- xmtp_mls/src/groups/mod.rs | 24 ++++++++++++++++++++---- xmtp_mls/src/groups/sync.rs | 16 ++++++++-------- 4 files changed, 62 insertions(+), 15 deletions(-) diff --git a/bindings_ffi/src/mls.rs b/bindings_ffi/src/mls.rs index 4571d59af..35d332d59 100644 --- a/bindings_ffi/src/mls.rs +++ b/bindings_ffi/src/mls.rs @@ -1584,7 +1584,11 @@ mod tests { use tokio::{sync::Notify, time::error::Elapsed}; use xmtp_cryptography::{signature::RecoverableSignature, utils::rng}; use xmtp_id::associations::generate_inbox_id; - use xmtp_mls::{storage::EncryptionKey, InboxOwner}; + use xmtp_mls::{ + groups::{GroupError, MlsGroup}, + storage::EncryptionKey, + InboxOwner, + }; #[derive(Clone)] pub struct LocalWalletInboxOwner { @@ -1728,6 +1732,20 @@ mod tests { new_test_client_with_wallet(wallet).await } + impl FfiGroup { + #[cfg(test)] + async fn update_installations(&self) -> Result<(), GroupError> { + let group = MlsGroup::new( + self.inner_client.context().clone(), + self.group_id.clone(), + self.created_at_ns, + ); + + group.update_installations(&self.inner_client).await?; + Ok(()) + } + } + #[tokio::test] async fn get_inbox_id() { let client = new_test_client().await; @@ -2464,6 +2482,8 @@ mod tests { // Recreate client2 (new installation) let client2 = new_test_client_with_wallet(wallet2).await; + client1_group.update_installations().await.unwrap(); + // Send a message that will break the group client1_group .send("This message will break the group".as_bytes().to_vec()) @@ -2517,6 +2537,8 @@ mod tests { let alix_group = alix.group(group.id()).unwrap(); let bo_group = bo.group(group.id()).unwrap(); let caro_group = caro.group(group.id()).unwrap(); + + alix_group.update_installations().await.unwrap(); log::info!("Alix sending first message"); // Alix sends a message in the group alix_group @@ -2525,6 +2547,7 @@ mod tests { .unwrap(); log::info!("Caro sending second message"); + caro_group.update_installations().await.unwrap(); // Caro sends a message in the group caro_group .send("Second message".as_bytes().to_vec()) @@ -2542,6 +2565,8 @@ mod tests { .await; bo_stream_messages.wait_for_ready().await; + alix_group.update_installations().await.unwrap(); + log::info!("Alix sending third message after Bo's second installation added"); // Alix sends a message to the group alix_group @@ -2555,6 +2580,7 @@ mod tests { log::info!("Bo sending fourth message"); // Bo sends a message to the group + bo2_group.update_installations().await.unwrap(); bo2_group .send("Fourth message".as_bytes().to_vec()) .await @@ -2562,6 +2588,7 @@ mod tests { log::info!("Caro sending fifth message"); // Caro sends a message in the group + caro_group.update_installations().await.unwrap(); caro_group .send("Fifth message".as_bytes().to_vec()) .await diff --git a/xmtp_mls/src/configuration.rs b/xmtp_mls/src/configuration.rs index 540505c7f..039299de2 100644 --- a/xmtp_mls/src/configuration.rs +++ b/xmtp_mls/src/configuration.rs @@ -12,9 +12,13 @@ pub const MAX_GROUP_SYNC_RETRIES: usize = 3; pub const MAX_INTENT_PUBLISH_ATTEMPTS: usize = 3; -const NANOSECONDS_IN_HOUR: i64 = 3_600_000_000_000; +const NS_IN_SEC: i64 = 1_000_000_000; -pub const UPDATE_INSTALLATIONS_INTERVAL_NS: i64 = NANOSECONDS_IN_HOUR / 2; // 30 min +const NS_IN_HOUR: i64 = NS_IN_SEC * 60 * 60; + +pub const SYNC_UPDATE_INSTALLATIONS_INTERVAL_NS: i64 = NS_IN_HOUR / 2; // 30 min + +pub const SEND_MESSAGE_UPDATE_INSTALLATIONS_INTERVAL_NS: i64 = 5 * NS_IN_SEC; pub const MAX_GROUP_SIZE: u16 = 400; diff --git a/xmtp_mls/src/groups/mod.rs b/xmtp_mls/src/groups/mod.rs index e9f4ca1de..17fa8c51f 100644 --- a/xmtp_mls/src/groups/mod.rs +++ b/xmtp_mls/src/groups/mod.rs @@ -74,6 +74,7 @@ use crate::{ configuration::{ CIPHERSUITE, GROUP_MEMBERSHIP_EXTENSION_ID, GROUP_PERMISSIONS_EXTENSION_ID, MAX_GROUP_SIZE, MAX_PAST_EPOCHS, MUTABLE_METADATA_EXTENSION_ID, + SEND_MESSAGE_UPDATE_INSTALLATIONS_INTERVAL_NS, }, hpke::{decrypt_welcome, HpkeError}, identity::{parse_credential, Identity, IdentityError}, @@ -454,10 +455,10 @@ impl MlsGroup { where ApiClient: XmtpApi, { - let update_interval = Some(5_000_000); // 5 seconds in nanoseconds + let update_interval_ns = Some(SEND_MESSAGE_UPDATE_INSTALLATIONS_INTERVAL_NS); let conn = self.context.store.conn()?; let provider = XmtpOpenMlsProvider::from(conn); - self.maybe_update_installations(&provider, update_interval, client) + self.maybe_update_installations(&provider, update_interval_ns, client) .await?; let message_id = self.prepare_message(message, provider.conn_ref(), |now| { @@ -480,14 +481,29 @@ impl MlsGroup { { let conn = self.context.store.conn()?; let provider = XmtpOpenMlsProvider::from(conn); - let update_interval = Some(5_000_000); - self.maybe_update_installations(&provider, update_interval, client) + let update_interval_ns = Some(SEND_MESSAGE_UPDATE_INSTALLATIONS_INTERVAL_NS); + self.maybe_update_installations(&provider, update_interval_ns, client) .await?; self.sync_until_last_intent_resolved(&provider, client) .await?; Ok(()) } + /// Update group installations + pub async fn update_installations( + &self, + client: &Client, + ) -> Result<(), GroupError> + where + ApiClient: XmtpApi, + { + let conn = self.context.store.conn()?; + let provider = XmtpOpenMlsProvider::from(conn); + self.maybe_update_installations(&provider, Some(0), client) + .await?; + Ok(()) + } + /// Send a message, optimistically returning the ID of the message before the result of a message publish. pub fn send_message_optimistic(&self, message: &[u8]) -> Result, GroupError> { let conn = self.context.store.conn()?; diff --git a/xmtp_mls/src/groups/sync.rs b/xmtp_mls/src/groups/sync.rs index 6f81c4eaa..3842a853c 100644 --- a/xmtp_mls/src/groups/sync.rs +++ b/xmtp_mls/src/groups/sync.rs @@ -18,7 +18,7 @@ use crate::{ codecs::{group_updated::GroupUpdatedCodec, ContentCodec}, configuration::{ GRPC_DATA_LIMIT, MAX_GROUP_SIZE, MAX_INTENT_PUBLISH_ATTEMPTS, MAX_PAST_EPOCHS, - UPDATE_INSTALLATIONS_INTERVAL_NS, + SYNC_UPDATE_INSTALLATIONS_INTERVAL_NS, }, groups::{ intents::UpdateMetadataIntentData, message_history::MessageHistoryContent, @@ -974,24 +974,24 @@ impl MlsGroup { pub async fn maybe_update_installations( &self, provider: &XmtpOpenMlsProvider, - update_interval: Option, + update_interval_ns: Option, client: &Client, ) -> Result<(), GroupError> where ApiClient: XmtpApi, { // determine how long of an interval in time to use before updating list - let interval = match update_interval { + let interval_ns = match update_interval_ns { Some(val) => val, - None => UPDATE_INSTALLATIONS_INTERVAL_NS, + None => SYNC_UPDATE_INSTALLATIONS_INTERVAL_NS, }; - let now = crate::utils::time::now_ns(); - let last = provider + let now_ns = crate::utils::time::now_ns(); + let last_ns = provider .conn_ref() .get_installations_time_checked(self.group_id.clone())?; - let elapsed = now - last; - if elapsed > interval { + let elapsed_ns = now_ns - last_ns; + if elapsed_ns > interval_ns { self.add_missing_installations(provider, client).await?; provider .conn_ref() From b30047408962aec7a24cc99760192b53aca2f3c6 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Thu, 29 Aug 2024 15:35:24 -0700 Subject: [PATCH 3/6] Create group with initial members (#1020) --- bindings_ffi/src/mls.rs | 16 ++++++++-------- xmtp_mls/src/client.rs | 23 +++++++++++++++++++++++ 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/bindings_ffi/src/mls.rs b/bindings_ffi/src/mls.rs index 35d332d59..8f4a4121b 100644 --- a/bindings_ffi/src/mls.rs +++ b/bindings_ffi/src/mls.rs @@ -714,14 +714,14 @@ impl FfiConversations { _ => None, }; - let convo = self - .inner_client - .create_group(group_permissions, metadata_options)?; - if !account_addresses.is_empty() { - convo - .add_members(&self.inner_client, account_addresses) - .await?; - } + let convo = if account_addresses.is_empty() { + self.inner_client + .create_group(group_permissions, metadata_options)? + } else { + self.inner_client + .create_group_with_members(account_addresses, group_permissions, metadata_options) + .await? + }; let out = Arc::new(FfiGroup { inner_client: self.inner_client.clone(), diff --git a/xmtp_mls/src/client.rs b/xmtp_mls/src/client.rs index 282e55eed..7fb3219b1 100644 --- a/xmtp_mls/src/client.rs +++ b/xmtp_mls/src/client.rs @@ -380,6 +380,29 @@ where Ok(group) } + pub async fn create_group_with_members( + &self, + account_addresses: Vec, + permissions_policy_set: Option, + opts: GroupMetadataOptions, + ) -> Result { + log::info!("creating group"); + + let group = MlsGroup::create_and_insert( + self.context.clone(), + GroupMembershipState::Allowed, + permissions_policy_set.unwrap_or_default(), + opts, + )?; + + group.add_members(self, account_addresses).await?; + + // notify any streams of the new group + let _ = self.local_events.send(LocalEvents::NewGroup(group.clone())); + + Ok(group) + } + pub(crate) fn create_sync_group(&self) -> Result { log::info!("creating sync group"); let sync_group = MlsGroup::create_and_insert_sync_group(self.context.clone())?; From 82ee23b174b8a1976d0ba14f65879f017e345509 Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Thu, 29 Aug 2024 17:40:55 -0600 Subject: [PATCH 4/6] Retry PoolNeedsConnection Errors (#1010) * big refator of connection * just make the error retryable * add new error that can be caught * add retries to the places that kick out into signature requests * Apply suggestions from code review * fix parenthesis --------- Co-authored-by: Andrew Plaza Co-authored-by: Andrew Plaza --- xmtp_mls/src/groups/mod.rs | 2 ++ xmtp_mls/src/groups/sync.rs | 2 +- xmtp_mls/src/identity_updates.rs | 39 +++++++++++++++++++++++++------- xmtp_mls/src/storage/errors.rs | 1 + 4 files changed, 35 insertions(+), 9 deletions(-) diff --git a/xmtp_mls/src/groups/mod.rs b/xmtp_mls/src/groups/mod.rs index 17fa8c51f..8499fd121 100644 --- a/xmtp_mls/src/groups/mod.rs +++ b/xmtp_mls/src/groups/mod.rs @@ -188,6 +188,8 @@ pub enum GroupError { SqlKeyStore(#[from] sql_key_store::SqlKeyStoreError), #[error("No pending commit found")] MissingPendingCommit, + #[error("Sync failed to wait for intent")] + SyncFailedToWait, } impl RetryableError for GroupError { diff --git a/xmtp_mls/src/groups/sync.rs b/xmtp_mls/src/groups/sync.rs index 3842a853c..bbcfbc41d 100644 --- a/xmtp_mls/src/groups/sync.rs +++ b/xmtp_mls/src/groups/sync.rs @@ -221,7 +221,7 @@ impl MlsGroup { num_attempts += 1; } - Err(last_err.unwrap_or(GroupError::Generic("failed to wait for intent".to_string()))) + Err(last_err.unwrap_or(GroupError::SyncFailedToWait)) } fn is_valid_epoch( diff --git a/xmtp_mls/src/identity_updates.rs b/xmtp_mls/src/identity_updates.rs index 20e656f9f..b4350eb53 100644 --- a/xmtp_mls/src/identity_updates.rs +++ b/xmtp_mls/src/identity_updates.rs @@ -1,6 +1,10 @@ use std::collections::{HashMap, HashSet}; -use crate::{retry::RetryableError, retryable, storage::association_state::StoredAssociationState}; +use crate::{ + retry::{Retry, RetryableError}, + retry_async, retryable, + storage::association_state::StoredAssociationState, +}; use prost::Message; use thiserror::Error; use xmtp_id::associations::{ @@ -239,9 +243,13 @@ where wallets_to_revoke: Vec, ) -> Result { let inbox_id = self.inbox_id(); - let current_state = self - .get_association_state(&self.store().conn()?, &inbox_id, None) - .await?; + let current_state = retry_async!( + Retry::default(), + (async { + self.get_association_state(&self.store().conn()?, &inbox_id, None) + .await + }) + )?; let mut builder = SignatureRequestBuilder::new(inbox_id); for wallet in wallets_to_revoke { @@ -259,9 +267,14 @@ where installation_ids: Vec>, ) -> Result { let inbox_id = self.inbox_id(); - let current_state = self - .get_association_state(&self.store().conn()?, &inbox_id, None) - .await?; + + let current_state = retry_async!( + Retry::default(), + (async { + self.get_association_state(&self.store().conn()?, &inbox_id, None) + .await + }) + )?; let mut builder = SignatureRequestBuilder::new(inbox_id); @@ -291,7 +304,17 @@ where .await?; // Load the identity updates for the inbox so that we have a record in our DB - load_identity_updates(&self.api_client, &self.store().conn()?, vec![inbox_id]).await?; + retry_async!( + Retry::default(), + (async { + load_identity_updates( + &self.api_client, + &self.store().conn()?, + vec![inbox_id.clone()], + ) + .await + }) + )?; Ok(()) } diff --git a/xmtp_mls/src/storage/errors.rs b/xmtp_mls/src/storage/errors.rs index c73d81b12..7e6b914f3 100644 --- a/xmtp_mls/src/storage/errors.rs +++ b/xmtp_mls/src/storage/errors.rs @@ -68,6 +68,7 @@ impl RetryableError for StorageError { Self::Pool(_) => true, Self::Lock(_) => true, Self::SqlCipherNotLoaded => true, + Self::PoolNeedsConnection => true, _ => false, } } From c4bc84fc60c03e3932892078a70a4b89fde5a34b Mon Sep 17 00:00:00 2001 From: Andrew Plaza Date: Thu, 29 Aug 2024 20:28:43 -0400 Subject: [PATCH 5/6] compile `xmtp_proto` for wasm32 (#1016) * compile xmtp_proto for wasm * fix tls errors --- Cargo.lock | 149 ++++++++---------- Cargo.toml | 10 +- bindings_ffi/Cargo.lock | 128 ++++++++------- bindings_ffi/Cargo.toml | 4 +- bindings_node/Cargo.lock | 136 ++++++++-------- bindings_node/Cargo.toml | 6 +- examples/cli/Cargo.toml | 4 +- mls_validation_service/Cargo.toml | 2 - xmtp_api_grpc/Cargo.toml | 4 +- xmtp_api_grpc/src/grpc_api_helper.rs | 2 +- xmtp_mls/Cargo.toml | 1 - xmtp_mls/src/api/mls.rs | 4 +- xmtp_proto/Cargo.toml | 11 +- xmtp_proto/buf.gen.yaml | 24 +-- xmtp_proto/src/gen/xmtp.identity.api.v1.rs | 3 +- .../src/gen/xmtp.identity.api.v1.serde.rs | 3 + .../src/gen/xmtp.identity.api.v1.tonic.rs | 29 +--- .../src/gen/xmtp.identity.associations.rs | 1 + .../gen/xmtp.identity.associations.serde.rs | 8 + xmtp_proto/src/gen/xmtp.identity.rs | 1 + xmtp_proto/src/gen/xmtp.keystore_api.v1.rs | 17 +- .../src/gen/xmtp.keystore_api.v1.serde.rs | 21 +++ xmtp_proto/src/gen/xmtp.message_api.v1.rs | 5 +- .../src/gen/xmtp.message_api.v1.serde.rs | 8 + .../src/gen/xmtp.message_api.v1.tonic.rs | 32 +--- xmtp_proto/src/gen/xmtp.message_contents.rs | 1 + .../src/gen/xmtp.message_contents.serde.rs | 38 +++++ xmtp_proto/src/gen/xmtp.mls.api.v1.rs | 3 +- xmtp_proto/src/gen/xmtp.mls.api.v1.serde.rs | 31 ++++ xmtp_proto/src/gen/xmtp.mls.api.v1.tonic.rs | 37 +---- xmtp_proto/src/gen/xmtp.mls.database.rs | 1 + xmtp_proto/src/gen/xmtp.mls.database.serde.rs | 4 + .../src/gen/xmtp.mls.message_contents.rs | 1 + .../gen/xmtp.mls.message_contents.serde.rs | 11 ++ xmtp_proto/src/gen/xmtp.mls_validation.v1.rs | 1 + .../src/gen/xmtp.mls_validation.v1.serde.rs | 8 + .../src/gen/xmtp.mls_validation.v1.tonic.rs | 31 +--- xmtp_proto/src/gen/xmtp.xmtpv4.rs | 5 +- xmtp_proto/src/gen/xmtp.xmtpv4.serde.rs | 10 ++ xmtp_proto/src/gen/xmtp.xmtpv4.tonic.rs | 27 +--- 40 files changed, 450 insertions(+), 372 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a6c8dafb1..dcfbe4341 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -275,18 +275,17 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[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.30", + "http 1.1.0", + "http-body 1.0.1", + "http-body-util", "itoa", "matchit", "memchr", @@ -295,7 +294,7 @@ dependencies = [ "pin-project-lite", "rustversion", "serde", - "sync_wrapper 0.1.2", + "sync_wrapper 1.0.1", "tower", "tower-layer", "tower-service", @@ -303,17 +302,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.1", + "http-body-util", "mime", + "pin-project-lite", "rustversion", + "sync_wrapper 0.1.2", "tower-layer", "tower-service", ] @@ -657,7 +659,7 @@ version = "4.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" dependencies = [ - "heck 0.5.0", + "heck", "proc-macro2", "quote", "syn 2.0.72", @@ -1183,7 +1185,7 @@ checksum = "c5d9abe6314103864cc2d8901b7ae224e0ab1a103a0a416661b4097b0779b607" dependencies = [ "darling", "either", - "heck 0.5.0", + "heck", "proc-macro2", "quote", "syn 2.0.72", @@ -2152,12 +2154,6 @@ dependencies = [ "http 0.2.12", ] -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - [[package]] name = "heck" version = "0.5.0" @@ -2419,14 +2415,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.30", + "hyper 1.4.1", + "hyper-util", "pin-project-lite", "tokio", - "tokio-io-timeout", + "tower-service", ] [[package]] @@ -2658,6 +2655,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.11" @@ -3497,9 +3503,9 @@ checksum = "1e91099d4268b0e11973f036e885d652fb0b21fedcf69738c627f94db6a44f42" [[package]] name = "pbjson" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1030c719b0ec2a2d25a5df729d6cff1acf3cc230bf766f4f97833591f7577b90" +checksum = "c7e6349fa080353f4a597daffd05cb81572a9c031a6d4fff7e504947496fcc68" dependencies = [ "base64 0.21.7", "serde", @@ -3507,21 +3513,21 @@ dependencies = [ [[package]] name = "pbjson-build" -version = "0.6.2" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2580e33f2292d34be285c5bc3dba5259542b083cfad6037b6d70345f24dcb735" +checksum = "6eea3058763d6e656105d1403cb04e0a41b7bbac6362d413e7c33be0c32279c9" dependencies = [ - "heck 0.4.1", - "itertools 0.11.0", + "heck", + "itertools 0.13.0", "prost", "prost-types", ] [[package]] name = "pbjson-types" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18f596653ba4ac51bdecbb4ef6773bc7f56042dc13927910de1684ad3d32aa12" +checksum = "e54e5e7bfb1652f95bc361d76f3c780d8e526b134b85417e774166ee941f0887" dependencies = [ "bytes", "chrono", @@ -3880,9 +3886,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.12.6" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "deb1435c188b76130da55f17a466d252ff7b1418b2ad3e037d127b94e3411f29" +checksum = "e13db3d3fde688c61e2446b4d843bc27a7e8af269a69440c0308021dc92333cc" dependencies = [ "bytes", "prost-derive", @@ -3890,12 +3896,12 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.12.6" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22505a5c94da8e3b7c2996394d1c933236c4d743e81a410bcca4e6989fc066a4" +checksum = "5bb182580f71dd070f88d01ce3de9f4da5021db7115d2e1c3605a754153b77c1" dependencies = [ "bytes", - "heck 0.5.0", + "heck", "itertools 0.12.1", "log", "multimap", @@ -3911,9 +3917,9 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.12.6" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1" +checksum = "18bec9b0adc4eba778b33684b7ba3e7137789434769ee3ce3930463ef904cfca" dependencies = [ "anyhow", "itertools 0.12.1", @@ -3924,9 +3930,9 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.12.6" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9091c90b0a32608e984ff2fa4091273cbdd755d54935c51d520887f4a1dbd5b0" +checksum = "cee5168b05f49d4b0ca581206eb14a7b22fafd963efe729ac48eb03266e25cc2" dependencies = [ "prost", ] @@ -4332,27 +4338,15 @@ dependencies = [ "sct", ] -[[package]] -name = "rustls" -version = "0.22.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" -dependencies = [ - "log", - "ring 0.17.8", - "rustls-pki-types", - "rustls-webpki 0.102.6", - "subtle", - "zeroize", -] - [[package]] name = "rustls" version = "0.23.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c58f8c84392efc0a126acce10fa59ff7b3d2ac06ab451a33f2741989b806b044" dependencies = [ + "log", "once_cell", + "ring 0.17.8", "rustls-pki-types", "rustls-webpki 0.102.6", "subtle", @@ -4361,9 +4355,9 @@ dependencies = [ [[package]] name = "rustls-native-certs" -version = "0.7.1" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a88d6d420651b496bdd98684116959239430022a115c1240e6c3993be0b15fba" +checksum = "e5bfb394eeed242e909609f56089eecfe5fda225042e8b171791b9c95f5931e5" dependencies = [ "openssl-probe", "rustls-pemfile 2.1.3", @@ -4880,7 +4874,7 @@ version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" dependencies = [ - "heck 0.5.0", + "heck", "proc-macro2", "quote", "rustversion", @@ -5228,16 +5222,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" @@ -5269,17 +5253,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-rustls" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" -dependencies = [ - "rustls 0.22.4", - "rustls-pki-types", - "tokio", -] - [[package]] name = "tokio-rustls" version = "0.26.0" @@ -5390,28 +5363,30 @@ dependencies = [ [[package]] name = "tonic" -version = "0.11.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76c4eb7a4e9ef9d4763600161f12f5070b92a578e1b634db88a6887844c91a13" +checksum = "c6f6ba989e4b2c58ae83d862d3a3e27690b6e3ae630d0deb59f3697f32aa88ad" dependencies = [ "async-stream", "async-trait", "axum", - "base64 0.21.7", + "base64 0.22.1", "bytes", - "h2 0.3.26", - "http 0.2.12", - "http-body 0.4.6", - "hyper 0.14.30", + "h2 0.4.5", + "http 1.1.0", + "http-body 1.0.1", + "http-body-util", + "hyper 1.4.1", "hyper-timeout", + "hyper-util", "percent-encoding", "pin-project", "prost", "rustls-native-certs", "rustls-pemfile 2.1.3", - "rustls-pki-types", + "socket2", "tokio", - "tokio-rustls 0.25.0", + "tokio-rustls 0.26.0", "tokio-stream", "tower", "tower-layer", diff --git a/Cargo.toml b/Cargo.toml index b51500397..cefde727d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,10 +41,10 @@ openmls = { git = "https://github.com/xmtp/openmls", rev = "87e7e257d8eb15d6662b openmls_basic_credential = { git = "https://github.com/xmtp/openmls", rev = "87e7e257d8eb15d6662b104518becfc75ef6db76" } openmls_rust_crypto = { git = "https://github.com/xmtp/openmls", rev = "87e7e257d8eb15d6662b104518becfc75ef6db76" } openmls_traits = { git = "https://github.com/xmtp/openmls", rev = "87e7e257d8eb15d6662b104518becfc75ef6db76" } -pbjson = "0.6.0" -pbjson-types = "0.6.0" -prost = "^0.12" -prost-types = "^0.12" +pbjson = "0.7.0" +pbjson-types = "0.7.0" +prost = "^0.13" +prost-types = "^0.13" rand = "0.8.5" regex = "1.10.4" rustc-hex = "2.1.0" @@ -54,7 +54,7 @@ sha2 = "0.10.8" thiserror = "1.0" tls_codec = "0.4.1" tokio = { version = "1.35.1", default-features = false } -tonic = "^0.11" +tonic = "^0.12" tracing = { version = "0.1" } tracing-subscriber = "0.3" url = "2.5.0" diff --git a/bindings_ffi/Cargo.lock b/bindings_ffi/Cargo.lock index 2881cdbfb..5a3700f04 100644 --- a/bindings_ffi/Cargo.lock +++ b/bindings_ffi/Cargo.lock @@ -288,18 +288,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.11", - "http-body 0.4.6", - "hyper 0.14.28", + "http 1.1.0", + "http-body 1.0.0", + "http-body-util", "itoa", "matchit", "memchr", @@ -308,7 +307,7 @@ dependencies = [ "pin-project-lite", "rustversion", "serde", - "sync_wrapper", + "sync_wrapper 1.0.1", "tower", "tower-layer", "tower-service", @@ -316,17 +315,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.11", - "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", ] @@ -2191,6 +2193,7 @@ dependencies = [ "http 1.1.0", "http-body 1.0.0", "httparse", + "httpdate", "itoa", "pin-project-lite", "smallvec", @@ -2214,14 +2217,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]] @@ -2416,6 +2420,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.10" @@ -3098,9 +3111,9 @@ checksum = "1e91099d4268b0e11973f036e885d652fb0b21fedcf69738c627f94db6a44f42" [[package]] name = "pbjson" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1030c719b0ec2a2d25a5df729d6cff1acf3cc230bf766f4f97833591f7577b90" +checksum = "c7e6349fa080353f4a597daffd05cb81572a9c031a6d4fff7e504947496fcc68" dependencies = [ "base64 0.21.7", "serde", @@ -3108,21 +3121,21 @@ dependencies = [ [[package]] name = "pbjson-build" -version = "0.6.2" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2580e33f2292d34be285c5bc3dba5259542b083cfad6037b6d70345f24dcb735" +checksum = "6eea3058763d6e656105d1403cb04e0a41b7bbac6362d413e7c33be0c32279c9" dependencies = [ - "heck 0.4.1", - "itertools 0.11.0", + "heck 0.5.0", + "itertools 0.13.0", "prost", "prost-types", ] [[package]] name = "pbjson-types" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18f596653ba4ac51bdecbb4ef6773bc7f56042dc13927910de1684ad3d32aa12" +checksum = "e54e5e7bfb1652f95bc361d76f3c780d8e526b134b85417e774166ee941f0887" dependencies = [ "bytes", "chrono", @@ -3473,9 +3486,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.12.6" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "deb1435c188b76130da55f17a466d252ff7b1418b2ad3e037d127b94e3411f29" +checksum = "e13db3d3fde688c61e2446b4d843bc27a7e8af269a69440c0308021dc92333cc" dependencies = [ "bytes", "prost-derive", @@ -3483,9 +3496,9 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.12.6" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22505a5c94da8e3b7c2996394d1c933236c4d743e81a410bcca4e6989fc066a4" +checksum = "5bb182580f71dd070f88d01ce3de9f4da5021db7115d2e1c3605a754153b77c1" dependencies = [ "bytes", "heck 0.5.0", @@ -3504,9 +3517,9 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.12.6" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1" +checksum = "18bec9b0adc4eba778b33684b7ba3e7137789434769ee3ce3930463ef904cfca" dependencies = [ "anyhow", "itertools 0.11.0", @@ -3517,9 +3530,9 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.12.6" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9091c90b0a32608e984ff2fa4091273cbdd755d54935c51d520887f4a1dbd5b0" +checksum = "cee5168b05f49d4b0ca581206eb14a7b22fafd963efe729ac48eb03266e25cc2" dependencies = [ "prost", ] @@ -3749,7 +3762,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", - "sync_wrapper", + "sync_wrapper 0.1.2", "system-configuration", "tokio", "tokio-native-tls", @@ -3931,11 +3944,12 @@ dependencies = [ [[package]] name = "rustls" -version = "0.22.4" +version = "0.23.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" +checksum = "ebbbdb961df0ad3f2652da8f3fdc4b36122f568f968f45ad3316f26c025c677b" dependencies = [ "log", + "once_cell", "ring 0.17.8", "rustls-pki-types", "rustls-webpki 0.102.2", @@ -3945,9 +3959,9 @@ dependencies = [ [[package]] name = "rustls-native-certs" -version = "0.7.0" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f1fb85efa936c42c6d5fc28d2629bb51e4b2f4b8a5211e297d599cc5a093792" +checksum = "e5bfb394eeed242e909609f56089eecfe5fda225042e8b171791b9c95f5931e5" dependencies = [ "openssl-probe", "rustls-pemfile 2.1.0", @@ -4525,6 +4539,12 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +[[package]] +name = "sync_wrapper" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" + [[package]] name = "system-configuration" version = "0.5.1" @@ -4722,16 +4742,6 @@ dependencies = [ "windows-sys 0.48.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.2.0" @@ -4765,11 +4775,11 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.25.0" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" +checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" dependencies = [ - "rustls 0.22.4", + "rustls 0.23.7", "rustls-pki-types", "tokio", ] @@ -4895,28 +4905,30 @@ dependencies = [ [[package]] name = "tonic" -version = "0.11.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76c4eb7a4e9ef9d4763600161f12f5070b92a578e1b634db88a6887844c91a13" +checksum = "c6f6ba989e4b2c58ae83d862d3a3e27690b6e3ae630d0deb59f3697f32aa88ad" dependencies = [ "async-stream", "async-trait", "axum", - "base64 0.21.7", + "base64 0.22.1", "bytes", - "h2 0.3.24", - "http 0.2.11", - "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", "rustls-native-certs", "rustls-pemfile 2.1.0", - "rustls-pki-types", + "socket2", "tokio", - "tokio-rustls 0.25.0", + "tokio-rustls 0.26.0", "tokio-stream", "tower", "tower-layer", diff --git a/bindings_ffi/Cargo.toml b/bindings_ffi/Cargo.toml index d4a1c31c1..4685dcb6f 100644 --- a/bindings_ffi/Cargo.toml +++ b/bindings_ffi/Cargo.toml @@ -19,8 +19,8 @@ uniffi_macros = "0.28.0" xmtp_api_grpc = { path = "../xmtp_api_grpc" } xmtp_cryptography = { path = "../xmtp_cryptography" } xmtp_id = { path = "../xmtp_id" } -xmtp_mls = { path = "../xmtp_mls", features = ["grpc", "native"] } -xmtp_proto = { path = "../xmtp_proto", features = ["proto_full", "grpc"] } +xmtp_mls = { path = "../xmtp_mls", features = ["native"] } +xmtp_proto = { path = "../xmtp_proto", features = ["proto_full"] } xmtp_user_preferences = { path = "../xmtp_user_preferences" } xmtp_v2 = { path = "../xmtp_v2" } diff --git a/bindings_node/Cargo.lock b/bindings_node/Cargo.lock index fb9c6a61e..e5c2040a8 100644 --- a/bindings_node/Cargo.lock +++ b/bindings_node/Cargo.lock @@ -185,18 +185,17 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[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", @@ -205,7 +204,7 @@ dependencies = [ "pin-project-lite", "rustversion", "serde", - "sync_wrapper", + "sync_wrapper 1.0.1", "tower", "tower-layer", "tower-service", @@ -213,17 +212,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", ] @@ -2005,6 +2007,7 @@ dependencies = [ "http 1.1.0", "http-body 1.0.0", "httparse", + "httpdate", "itoa", "pin-project-lite", "smallvec", @@ -2028,14 +2031,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]] @@ -2228,6 +2232,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.11" @@ -2920,9 +2933,9 @@ checksum = "1e91099d4268b0e11973f036e885d652fb0b21fedcf69738c627f94db6a44f42" [[package]] name = "pbjson" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1030c719b0ec2a2d25a5df729d6cff1acf3cc230bf766f4f97833591f7577b90" +checksum = "c7e6349fa080353f4a597daffd05cb81572a9c031a6d4fff7e504947496fcc68" dependencies = [ "base64 0.21.7", "serde", @@ -2930,21 +2943,21 @@ dependencies = [ [[package]] name = "pbjson-build" -version = "0.6.2" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2580e33f2292d34be285c5bc3dba5259542b083cfad6037b6d70345f24dcb735" +checksum = "6eea3058763d6e656105d1403cb04e0a41b7bbac6362d413e7c33be0c32279c9" dependencies = [ - "heck 0.4.1", - "itertools 0.11.0", + "heck 0.5.0", + "itertools 0.13.0", "prost", "prost-types", ] [[package]] name = "pbjson-types" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18f596653ba4ac51bdecbb4ef6773bc7f56042dc13927910de1684ad3d32aa12" +checksum = "e54e5e7bfb1652f95bc361d76f3c780d8e526b134b85417e774166ee941f0887" dependencies = [ "bytes", "chrono", @@ -3246,9 +3259,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.12.6" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "deb1435c188b76130da55f17a466d252ff7b1418b2ad3e037d127b94e3411f29" +checksum = "e13db3d3fde688c61e2446b4d843bc27a7e8af269a69440c0308021dc92333cc" dependencies = [ "bytes", "prost-derive", @@ -3256,9 +3269,9 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.12.6" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22505a5c94da8e3b7c2996394d1c933236c4d743e81a410bcca4e6989fc066a4" +checksum = "5bb182580f71dd070f88d01ce3de9f4da5021db7115d2e1c3605a754153b77c1" dependencies = [ "bytes", "heck 0.5.0", @@ -3277,9 +3290,9 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.12.6" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1" +checksum = "18bec9b0adc4eba778b33684b7ba3e7137789434769ee3ce3930463ef904cfca" dependencies = [ "anyhow", "itertools 0.12.1", @@ -3290,9 +3303,9 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.12.6" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9091c90b0a32608e984ff2fa4091273cbdd755d54935c51d520887f4a1dbd5b0" +checksum = "cee5168b05f49d4b0ca581206eb14a7b22fafd963efe729ac48eb03266e25cc2" dependencies = [ "prost", ] @@ -3459,7 +3472,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", - "sync_wrapper", + "sync_wrapper 0.1.2", "system-configuration", "tokio", "tokio-rustls 0.24.1", @@ -3502,7 +3515,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", - "sync_wrapper", + "sync_wrapper 0.1.2", "system-configuration", "tokio", "tokio-native-tls", @@ -3684,23 +3697,24 @@ dependencies = [ [[package]] name = "rustls" -version = "0.22.4" +version = "0.23.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" +checksum = "c58f8c84392efc0a126acce10fa59ff7b3d2ac06ab451a33f2741989b806b044" dependencies = [ "log", + "once_cell", "ring 0.17.8", "rustls-pki-types", - "rustls-webpki 0.102.4", + "rustls-webpki 0.102.7", "subtle", "zeroize", ] [[package]] name = "rustls-native-certs" -version = "0.7.0" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f1fb85efa936c42c6d5fc28d2629bb51e4b2f4b8a5211e297d599cc5a093792" +checksum = "e5bfb394eeed242e909609f56089eecfe5fda225042e8b171791b9c95f5931e5" dependencies = [ "openssl-probe", "rustls-pemfile 2.1.2", @@ -3746,9 +3760,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.102.4" +version = "0.102.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff448f7e92e913c4b7d4c6d8e4540a1724b319b4152b8aef6d4cf8339712b33e" +checksum = "84678086bd54edf2b415183ed7a94d0efb049f1b646a33e22a36f3794be6ae56" dependencies = [ "ring 0.17.8", "rustls-pki-types", @@ -4228,6 +4242,12 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +[[package]] +name = "sync_wrapper" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" + [[package]] name = "system-configuration" version = "0.5.1" @@ -4393,16 +4413,6 @@ dependencies = [ "windows-sys 0.48.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.2.0" @@ -4436,11 +4446,11 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.25.0" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" +checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" dependencies = [ - "rustls 0.22.4", + "rustls 0.23.12", "rustls-pki-types", "tokio", ] @@ -4532,28 +4542,30 @@ dependencies = [ [[package]] name = "tonic" -version = "0.11.0" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76c4eb7a4e9ef9d4763600161f12f5070b92a578e1b634db88a6887844c91a13" +checksum = "c6f6ba989e4b2c58ae83d862d3a3e27690b6e3ae630d0deb59f3697f32aa88ad" dependencies = [ "async-stream", "async-trait", "axum", - "base64 0.21.7", + "base64 0.22.1", "bytes", - "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", "rustls-native-certs", "rustls-pemfile 2.1.2", - "rustls-pki-types", + "socket2", "tokio", - "tokio-rustls 0.25.0", + "tokio-rustls 0.26.0", "tokio-stream", "tower", "tower-layer", diff --git a/bindings_node/Cargo.toml b/bindings_node/Cargo.toml index 23711717c..9d10429ad 100644 --- a/bindings_node/Cargo.toml +++ b/bindings_node/Cargo.toml @@ -17,14 +17,14 @@ napi = { version = "2.12.2", default-features = false, features = [ "async", ] } napi-derive = "2.12.2" -prost = "^0.12" +prost = "^0.13" rand = "0.8.5" tokio = { version = "1.35.1", features = ["macros", "rt-multi-thread", "time"] } -tonic = { version = "^0.11", features = ["tls"] } +tonic = { version = "^0.12", features = ["tls"] } xmtp_api_grpc = { path = "../xmtp_api_grpc" } xmtp_cryptography = { path = "../xmtp_cryptography" } xmtp_id = { path = "../xmtp_id" } -xmtp_mls = { path = "../xmtp_mls", features = ["grpc", "native"] } +xmtp_mls = { path = "../xmtp_mls", features = ["native"] } xmtp_proto = { path = "../xmtp_proto", features = ["proto_full"] } [build-dependencies] diff --git a/examples/cli/Cargo.toml b/examples/cli/Cargo.toml index 3d3674e37..861e168a0 100644 --- a/examples/cli/Cargo.toml +++ b/examples/cli/Cargo.toml @@ -36,5 +36,5 @@ url = "2.3.1" xmtp_api_grpc = { path = "../../xmtp_api_grpc" } xmtp_cryptography = { path = "../../xmtp_cryptography" } xmtp_id = { path = "../../xmtp_id" } -xmtp_mls = { path = "../../xmtp_mls", features = ["grpc", "native"] } -xmtp_proto = { path = "../../xmtp_proto", features = ["proto_full", "grpc"] } +xmtp_mls = { path = "../../xmtp_mls", features = ["native"] } +xmtp_proto = { path = "../../xmtp_proto", features = ["proto_full"] } diff --git a/mls_validation_service/Cargo.toml b/mls_validation_service/Cargo.toml index 034702610..6da9cbdb5 100644 --- a/mls_validation_service/Cargo.toml +++ b/mls_validation_service/Cargo.toml @@ -27,8 +27,6 @@ xmtp_id.workspace = true xmtp_mls.workspace = true xmtp_proto = { path = "../xmtp_proto", features = [ "proto_full", - "grpc", - "tonic", "convert", ] } diff --git a/xmtp_api_grpc/Cargo.toml b/xmtp_api_grpc/Cargo.toml index 1271b2833..d96a19b1d 100644 --- a/xmtp_api_grpc/Cargo.toml +++ b/xmtp_api_grpc/Cargo.toml @@ -16,11 +16,11 @@ serde = { workspace = true, features = ["derive"] } tokio = { workspace = true, features = ["macros", "rt-multi-thread", "time"] } tonic = { workspace = true, features = [ "tls", - "tls-roots", + "tls-native-roots", "tls-webpki-roots", ] } tracing.workspace = true -xmtp_proto = { path = "../xmtp_proto", features = ["proto_full", "grpc"] } +xmtp_proto = { path = "../xmtp_proto", features = ["proto_full"] } xmtp_v2 = { path = "../xmtp_v2" } [dev-dependencies] diff --git a/xmtp_api_grpc/src/grpc_api_helper.rs b/xmtp_api_grpc/src/grpc_api_helper.rs index 06683fa62..7f9235405 100644 --- a/xmtp_api_grpc/src/grpc_api_helper.rs +++ b/xmtp_api_grpc/src/grpc_api_helper.rs @@ -56,7 +56,7 @@ async fn create_tls_channel(address: String) -> Result { // Functionality: If a ping response is not received within this duration, the connection is presumed to be lost and is closed. // Impact: This setting is crucial for quickly detecting unresponsive connections and freeing up resources associated with them. It ensures that the client has up-to-date information on the status of connections and can react accordingly. .keep_alive_timeout(Duration::from_secs(25)) - .tls_config(ClientTlsConfig::new()) + .tls_config(ClientTlsConfig::new().with_enabled_roots()) .map_err(|e| Error::new(ErrorKind::SetupTLSConfigError).with(e))? .connect() .await diff --git a/xmtp_mls/Cargo.toml b/xmtp_mls/Cargo.toml index daf7554fc..c992137ba 100644 --- a/xmtp_mls/Cargo.toml +++ b/xmtp_mls/Cargo.toml @@ -19,7 +19,6 @@ bench = [ "xmtp_api_grpc", ] default = ["native"] -grpc = ["xmtp_proto/grpc"] http-api = ["xmtp_api_http"] native = ["libsqlite3-sys/bundled-sqlcipher-vendored-openssl"] test-utils = [] diff --git a/xmtp_mls/src/api/mls.rs b/xmtp_mls/src/api/mls.rs index e12dd9574..7ac073f26 100644 --- a/xmtp_mls/src/api/mls.rs +++ b/xmtp_mls/src/api/mls.rs @@ -424,7 +424,7 @@ pub mod tests { // Set expectation for first request with no cursor mock_api .expect_query_group_messages() - .withf(move |req| match req.paging_info.clone() { + .withf(move |req| match req.paging_info { Some(paging_info) => paging_info.id_cursor == 0, None => true, }) @@ -443,7 +443,7 @@ pub mod tests { // Set expectation for requests with a cursor mock_api .expect_query_group_messages() - .withf(|req| match req.paging_info.clone() { + .withf(|req| match req.paging_info { Some(paging_info) => paging_info.id_cursor > 0, None => false, }) diff --git a/xmtp_proto/Cargo.toml b/xmtp_proto/Cargo.toml index f919ef79a..b231be0f7 100644 --- a/xmtp_proto/Cargo.toml +++ b/xmtp_proto/Cargo.toml @@ -11,16 +11,19 @@ pbjson-types.workspace = true pbjson.workspace = true prost = { workspace = true, features = ["prost-derive"] } # Only necessary if using Protobuf well-known types: -openmls = { workspace = true, optional = true } -openmls_basic_credential = { workspace = true, optional = true } prost-types = { workspace = true } serde = { workspace = true } -tonic = { workspace = true, optional = true } +openmls_basic_credential = { workspace = true, optional = true } +openmls = { workspace = true, optional = true } + +[target.'cfg(not(target_arch = "wasm32"))'.dependencies] +tonic = { workspace = true } + [features] convert = ["openmls_basic_credential", "openmls", "proto_full"] default = [] -grpc = ["tonic"] + # @@protoc_deletion_point(features) # This section is automatically generated by protoc-gen-prost-crate. # Changes in this area may be lost on regeneration. diff --git a/xmtp_proto/buf.gen.yaml b/xmtp_proto/buf.gen.yaml index aa5ea1dae..4ca89dd90 100644 --- a/xmtp_proto/buf.gen.yaml +++ b/xmtp_proto/buf.gen.yaml @@ -2,29 +2,31 @@ version: v1 managed: enabled: true plugins: - - plugin: buf.build/community/neoeinstein-prost:v0.3.1 + - plugin: buf.build/community/neoeinstein-prost:v0.4.0 out: src/gen opt: - compile_well_known_types - extern_path=.google.protobuf=::pbjson_types - file_descriptor_set - - plugin: buf.build/community/neoeinstein-prost-serde:v0.3.0 + - plugin: buf.build/community/neoeinstein-prost-serde:v0.3.1 out: src/gen - - plugin: buf.build/community/neoeinstein-tonic:v0.4.0 + - plugin: buf.build/community/neoeinstein-tonic:v0.4.1 out: src/gen opt: - no_server=false - compile_well_known_types - extern_path=.google.protobuf=::pbjson_types # Exclude it from non-tonic builds (so we can use the rest in Wasm) - - client_mod_attribute=xmtp.identity.api.v1=#[cfg(feature = "tonic")] - - client_mod_attribute=xmtp.message_api.v1=#[cfg(feature = "tonic")] - - client_mod_attribute=xmtp.mls.api.v1=#[cfg(feature = "tonic")] - - client_mod_attribute=xmtp.mls_validation.v1=#[cfg(feature = "tonic")] - - server_mod_attribute=xmtp.identity.api.v1=#[cfg(feature = "tonic")] - - server_mod_attribute=xmtp.mls_validation.v1=#[cfg(feature = "tonic")] - - server_mod_attribute=xmtp.message_api.v1=#[cfg(feature = "tonic")] - - server_mod_attribute=xmtp.mls.api.v1=#[cfg(feature = "tonic")] + - client_mod_attribute=xmtp.identity.api.v1=#[cfg(not(target_arch = "wasm32"))] + - client_mod_attribute=xmtp.message_api.v1=#[cfg(not(target_arch = "wasm32"))] + - client_mod_attribute=xmtp.mls.api.v1=#[cfg(not(target_arch = "wasm32"))] + - client_mod_attribute=xmtp.mls_validation.v1=#[cfg(not(target_arch = "wasm32"))] + - client_mod_attribute=xmtp.xmtpv4=#[cfg(not(target_arch = "wasm32"))] + - server_mod_attribute=xmtp.identity.api.v1=#[cfg(not(target_arch = "wasm32"))] + - server_mod_attribute=xmtp.mls_validation.v1=#[cfg(not(target_arch = "wasm32"))] + - server_mod_attribute=xmtp.message_api.v1=#[cfg(not(target_arch = "wasm32"))] + - server_mod_attribute=xmtp.mls.api.v1=#[cfg(not(target_arch = "wasm32"))] + - server_mod_attribute=xmtp.xmtpv4=#[cfg(not(target_arch = "wasm32"))] - name: prost-crate out: . strategy: all diff --git a/xmtp_proto/src/gen/xmtp.identity.api.v1.rs b/xmtp_proto/src/gen/xmtp.identity.api.v1.rs index 5079157b9..0b77836b7 100644 --- a/xmtp_proto/src/gen/xmtp.identity.api.v1.rs +++ b/xmtp_proto/src/gen/xmtp.identity.api.v1.rs @@ -1,4 +1,5 @@ // @generated +// This file is @generated by prost-build. /// Publishes an identity update to the network #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -8,7 +9,7 @@ pub struct PublishIdentityUpdateRequest { } /// The response when an identity update is published #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct PublishIdentityUpdateResponse { } /// Get all updates for an identity since the specified time diff --git a/xmtp_proto/src/gen/xmtp.identity.api.v1.serde.rs b/xmtp_proto/src/gen/xmtp.identity.api.v1.serde.rs index 029e46b6a..ed2e88547 100644 --- a/xmtp_proto/src/gen/xmtp.identity.api.v1.serde.rs +++ b/xmtp_proto/src/gen/xmtp.identity.api.v1.serde.rs @@ -110,6 +110,7 @@ impl serde::Serialize for get_identity_updates_request::Request { } if self.sequence_id != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("sequenceId", ToString::to_string(&self.sequence_id).as_str())?; } struct_ser.end() @@ -314,10 +315,12 @@ impl serde::Serialize for get_identity_updates_response::IdentityUpdateLog { let mut struct_ser = serializer.serialize_struct("xmtp.identity.api.v1.GetIdentityUpdatesResponse.IdentityUpdateLog", len)?; if self.sequence_id != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("sequenceId", ToString::to_string(&self.sequence_id).as_str())?; } if self.server_timestamp_ns != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("serverTimestampNs", ToString::to_string(&self.server_timestamp_ns).as_str())?; } if let Some(v) = self.update.as_ref() { diff --git a/xmtp_proto/src/gen/xmtp.identity.api.v1.tonic.rs b/xmtp_proto/src/gen/xmtp.identity.api.v1.tonic.rs index 90f53d301..52a54f8e5 100644 --- a/xmtp_proto/src/gen/xmtp.identity.api.v1.tonic.rs +++ b/xmtp_proto/src/gen/xmtp.identity.api.v1.tonic.rs @@ -1,6 +1,6 @@ // @generated /// Generated client implementations. -#[cfg(feature = "tonic")] +#[cfg(not(target_arch = "wasm32"))] pub mod identity_api_client { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; @@ -175,7 +175,7 @@ pub mod identity_api_client { } } /// Generated server implementations. -#[cfg(feature = "tonic")] +#[cfg(not(target_arch = "wasm32"))] pub mod identity_api_server { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; @@ -206,19 +206,17 @@ pub mod identity_api_server { } #[derive(Debug)] pub struct IdentityApiServer { - inner: _Inner, + inner: Arc, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, max_decoding_message_size: Option, max_encoding_message_size: Option, } - struct _Inner(Arc); impl IdentityApiServer { 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(), @@ -281,7 +279,6 @@ pub mod identity_api_server { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { - let inner = self.inner.clone(); match req.uri().path() { "/xmtp.identity.api.v1.IdentityApi/PublishIdentityUpdate" => { #[allow(non_camel_case_types)] @@ -313,7 +310,6 @@ pub mod identity_api_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 = PublishIdentityUpdateSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -360,7 +356,6 @@ pub mod identity_api_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 = GetIdentityUpdatesSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -406,7 +401,6 @@ pub mod identity_api_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 = GetInboxIdsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -428,8 +422,11 @@ pub mod identity_api_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(), ) @@ -450,16 +447,6 @@ pub mod identity_api_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 IdentityApiServer { const NAME: &'static str = "xmtp.identity.api.v1.IdentityApi"; } diff --git a/xmtp_proto/src/gen/xmtp.identity.associations.rs b/xmtp_proto/src/gen/xmtp.identity.associations.rs index beb97ec02..8ec6b99a5 100644 --- a/xmtp_proto/src/gen/xmtp.identity.associations.rs +++ b/xmtp_proto/src/gen/xmtp.identity.associations.rs @@ -1,4 +1,5 @@ // @generated +// This file is @generated by prost-build. /// RecoverableEcdsaSignature for EIP-191 and V2 signatures #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] diff --git a/xmtp_proto/src/gen/xmtp.identity.associations.serde.rs b/xmtp_proto/src/gen/xmtp.identity.associations.serde.rs index abe5f4671..89ceafd87 100644 --- a/xmtp_proto/src/gen/xmtp.identity.associations.serde.rs +++ b/xmtp_proto/src/gen/xmtp.identity.associations.serde.rs @@ -518,6 +518,7 @@ impl serde::Serialize for CreateInbox { } if self.nonce != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("nonce", ToString::to_string(&self.nonce).as_str())?; } if let Some(v) = self.initial_address_signature.as_ref() { @@ -785,6 +786,7 @@ impl serde::Serialize for IdentityUpdate { } if self.client_timestamp_ns != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("clientTimestampNs", ToString::to_string(&self.client_timestamp_ns).as_str())?; } if !self.inbox_id.is_empty() { @@ -1129,6 +1131,7 @@ impl serde::Serialize for MemberIdentifier { } member_identifier::Kind::InstallationPublicKey(v) => { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("installationPublicKey", pbjson::private::base64::encode(&v).as_str())?; } } @@ -1341,6 +1344,7 @@ impl serde::Serialize for RecoverableEcdsaSignature { let mut struct_ser = serializer.serialize_struct("xmtp.identity.associations.RecoverableEcdsaSignature", len)?; if !self.bytes.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("bytes", pbjson::private::base64::encode(&self.bytes).as_str())?; } struct_ser.end() @@ -1438,10 +1442,12 @@ impl serde::Serialize for RecoverableEd25519Signature { let mut struct_ser = serializer.serialize_struct("xmtp.identity.associations.RecoverableEd25519Signature", len)?; if !self.bytes.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("bytes", pbjson::private::base64::encode(&self.bytes).as_str())?; } if !self.public_key.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("publicKey", pbjson::private::base64::encode(&self.public_key).as_str())?; } struct_ser.end() @@ -1811,10 +1817,12 @@ impl serde::Serialize for SmartContractWalletSignature { } if self.block_number != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("blockNumber", ToString::to_string(&self.block_number).as_str())?; } if !self.signature.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("signature", pbjson::private::base64::encode(&self.signature).as_str())?; } if !self.chain_rpc_url.is_empty() { diff --git a/xmtp_proto/src/gen/xmtp.identity.rs b/xmtp_proto/src/gen/xmtp.identity.rs index b4e176f71..2fb0a5ab9 100644 --- a/xmtp_proto/src/gen/xmtp.identity.rs +++ b/xmtp_proto/src/gen/xmtp.identity.rs @@ -1,4 +1,5 @@ // @generated +// This file is @generated by prost-build. /// A credential that can be used in MLS leaf nodes #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] diff --git a/xmtp_proto/src/gen/xmtp.keystore_api.v1.rs b/xmtp_proto/src/gen/xmtp.keystore_api.v1.rs index 6aae2dd4d..65ac75867 100644 --- a/xmtp_proto/src/gen/xmtp.keystore_api.v1.rs +++ b/xmtp_proto/src/gen/xmtp.keystore_api.v1.rs @@ -1,4 +1,5 @@ // @generated +// This file is @generated by prost-build. /// Wrapper class for errors from the Keystore API #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -322,7 +323,7 @@ pub mod save_invites_response { } /// CreateAuthTokenRequest is used to create an auth token for the XMTP API #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct CreateAuthTokenRequest { #[prost(uint64, optional, tag="1")] pub timestamp_ns: ::core::option::Option, @@ -337,7 +338,7 @@ pub struct SaveV1ConversationsRequest { } /// Placeholder response type for SaveV1Conversations #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct SaveV1ConversationsResponse { } /// Response for GetV2Conversations @@ -357,7 +358,7 @@ pub struct GetKeystoreStatusRequest { } /// Response to GetKeystoreStatusRequest #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct GetKeystoreStatusResponse { #[prost(enumeration="get_keystore_status_response::KeystoreStatus", tag="1")] pub status: i32, @@ -432,7 +433,7 @@ pub struct SignDigestRequest { /// Nested message and enum types in `SignDigestRequest`. pub mod sign_digest_request { #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] +#[derive(Clone, Copy, PartialEq, ::prost::Oneof)] pub enum Signer { #[prost(bool, tag="2")] IdentityKey(bool), @@ -442,21 +443,21 @@ pub mod sign_digest_request { } /// GetRefreshJobRequest is used to get the last run time of a refresh job #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct GetRefreshJobRequest { #[prost(enumeration="JobType", tag="1")] pub job_type: i32, } /// GetRefreshJobResponse is used to return the last run time of a refresh job #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct GetRefreshJobResponse { #[prost(int64, tag="1")] pub last_run_ns: i64, } /// SetRefreshJobRequest is used to set the last run time of a refresh job #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct SetRefeshJobRequest { #[prost(enumeration="JobType", tag="1")] pub job_type: i32, @@ -465,7 +466,7 @@ pub struct SetRefeshJobRequest { } /// SetRefreshJobResponse is an empty response type #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct SetRefreshJobResponse { } /// A mapping of topics to their decrypted invitations diff --git a/xmtp_proto/src/gen/xmtp.keystore_api.v1.serde.rs b/xmtp_proto/src/gen/xmtp.keystore_api.v1.serde.rs index 7160e4c43..004d74ecf 100644 --- a/xmtp_proto/src/gen/xmtp.keystore_api.v1.serde.rs +++ b/xmtp_proto/src/gen/xmtp.keystore_api.v1.serde.rs @@ -13,6 +13,7 @@ impl serde::Serialize for CreateAuthTokenRequest { let mut struct_ser = serializer.serialize_struct("xmtp.keystore_api.v1.CreateAuthTokenRequest", len)?; if let Some(v) = self.timestamp_ns.as_ref() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("timestampNs", ToString::to_string(&v).as_str())?; } struct_ser.end() @@ -123,6 +124,7 @@ impl serde::Serialize for CreateInviteRequest { } if self.created_ns != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("createdNs", ToString::to_string(&self.created_ns).as_str())?; } if let Some(v) = self.consent_proof.as_ref() { @@ -261,6 +263,7 @@ impl serde::Serialize for CreateInviteResponse { } if !self.payload.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("payload", pbjson::private::base64::encode(&self.payload).as_str())?; } struct_ser.end() @@ -566,6 +569,7 @@ impl serde::Serialize for decrypt_response::response::Success { let mut struct_ser = serializer.serialize_struct("xmtp.keystore_api.v1.DecryptResponse.Response.Success", len)?; if !self.decrypted.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("decrypted", pbjson::private::base64::encode(&self.decrypted).as_str())?; } struct_ser.end() @@ -766,6 +770,7 @@ impl serde::Serialize for decrypt_v1_request::Request { } if !self.header_bytes.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("headerBytes", pbjson::private::base64::encode(&self.header_bytes).as_str())?; } if self.is_sender { @@ -999,6 +1004,7 @@ impl serde::Serialize for decrypt_v2_request::Request { } if !self.header_bytes.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("headerBytes", pbjson::private::base64::encode(&self.header_bytes).as_str())?; } if !self.content_topic.is_empty() { @@ -1326,6 +1332,7 @@ impl serde::Serialize for encrypt_response::response::Success { } if !self.sender_hmac.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("senderHmac", pbjson::private::base64::encode(&self.sender_hmac).as_str())?; } struct_ser.end() @@ -1532,10 +1539,12 @@ impl serde::Serialize for encrypt_v1_request::Request { } if !self.payload.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("payload", pbjson::private::base64::encode(&self.payload).as_str())?; } if !self.header_bytes.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("headerBytes", pbjson::private::base64::encode(&self.header_bytes).as_str())?; } struct_ser.end() @@ -1752,10 +1761,12 @@ impl serde::Serialize for encrypt_v2_request::Request { let mut struct_ser = serializer.serialize_struct("xmtp.keystore_api.v1.EncryptV2Request.Request", len)?; if !self.payload.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("payload", pbjson::private::base64::encode(&self.payload).as_str())?; } if !self.header_bytes.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("headerBytes", pbjson::private::base64::encode(&self.header_bytes).as_str())?; } if !self.content_topic.is_empty() { @@ -2144,6 +2155,7 @@ impl serde::Serialize for get_conversation_hmac_keys_response::HmacKeyData { } if !self.hmac_key.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("hmacKey", pbjson::private::base64::encode(&self.hmac_key).as_str())?; } struct_ser.end() @@ -2879,6 +2891,7 @@ impl serde::Serialize for GetRefreshJobResponse { let mut struct_ser = serializer.serialize_struct("xmtp.keystore_api.v1.GetRefreshJobResponse", len)?; if self.last_run_ns != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("lastRunNs", ToString::to_string(&self.last_run_ns).as_str())?; } struct_ser.end() @@ -3448,10 +3461,12 @@ impl serde::Serialize for save_invites_request::Request { } if self.timestamp_ns != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("timestampNs", ToString::to_string(&self.timestamp_ns).as_str())?; } if !self.payload.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("payload", pbjson::private::base64::encode(&self.payload).as_str())?; } struct_ser.end() @@ -4116,6 +4131,7 @@ impl serde::Serialize for self_decrypt_request::Request { let mut struct_ser = serializer.serialize_struct("xmtp.keystore_api.v1.SelfDecryptRequest.Request", len)?; if !self.payload.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("payload", pbjson::private::base64::encode(&self.payload).as_str())?; } struct_ser.end() @@ -4301,6 +4317,7 @@ impl serde::Serialize for self_encrypt_request::Request { let mut struct_ser = serializer.serialize_struct("xmtp.keystore_api.v1.SelfEncryptRequest.Request", len)?; if !self.payload.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("payload", pbjson::private::base64::encode(&self.payload).as_str())?; } struct_ser.end() @@ -4595,6 +4612,7 @@ impl serde::Serialize for self_encrypt_response::response::Success { let mut struct_ser = serializer.serialize_struct("xmtp.keystore_api.v1.SelfEncryptResponse.Response.Success", len)?; if !self.encrypted.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("encrypted", pbjson::private::base64::encode(&self.encrypted).as_str())?; } struct_ser.end() @@ -4697,6 +4715,7 @@ impl serde::Serialize for SetRefeshJobRequest { } if self.last_run_ns != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("lastRunNs", ToString::to_string(&self.last_run_ns).as_str())?; } struct_ser.end() @@ -4878,6 +4897,7 @@ impl serde::Serialize for SignDigestRequest { let mut struct_ser = serializer.serialize_struct("xmtp.keystore_api.v1.SignDigestRequest", len)?; if !self.digest.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("digest", pbjson::private::base64::encode(&self.digest).as_str())?; } if let Some(v) = self.signer.as_ref() { @@ -5103,6 +5123,7 @@ impl serde::Serialize for topic_map::TopicData { let mut struct_ser = serializer.serialize_struct("xmtp.keystore_api.v1.TopicMap.TopicData", len)?; if self.created_ns != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("createdNs", ToString::to_string(&self.created_ns).as_str())?; } if !self.peer_address.is_empty() { diff --git a/xmtp_proto/src/gen/xmtp.message_api.v1.rs b/xmtp_proto/src/gen/xmtp.message_api.v1.rs index 2c049df29..cdc466411 100644 --- a/xmtp_proto/src/gen/xmtp.message_api.v1.rs +++ b/xmtp_proto/src/gen/xmtp.message_api.v1.rs @@ -1,4 +1,5 @@ // @generated +// This file is @generated by prost-build. /// Token is used by clients to prove to the nodes /// that they are serving a specific wallet. #[allow(clippy::derive_partial_eq_without_eq)] @@ -101,7 +102,7 @@ pub struct PublishRequest { } /// Empty message as a response for Publish #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct PublishResponse { } /// Subscribe @@ -113,7 +114,7 @@ pub struct SubscribeRequest { } /// SubscribeAll #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct SubscribeAllRequest { } /// Query diff --git a/xmtp_proto/src/gen/xmtp.message_api.v1.serde.rs b/xmtp_proto/src/gen/xmtp.message_api.v1.serde.rs index bb932c481..2fae2170d 100644 --- a/xmtp_proto/src/gen/xmtp.message_api.v1.serde.rs +++ b/xmtp_proto/src/gen/xmtp.message_api.v1.serde.rs @@ -19,6 +19,7 @@ impl serde::Serialize for AuthData { } if self.created_ns != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("createdNs", ToString::to_string(&self.created_ns).as_str())?; } struct_ser.end() @@ -413,10 +414,12 @@ impl serde::Serialize for Envelope { } if self.timestamp_ns != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("timestampNs", ToString::to_string(&self.timestamp_ns).as_str())?; } if !self.message.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("message", pbjson::private::base64::encode(&self.message).as_str())?; } struct_ser.end() @@ -540,10 +543,12 @@ impl serde::Serialize for IndexCursor { let mut struct_ser = serializer.serialize_struct("xmtp.message_api.v1.IndexCursor", len)?; if !self.digest.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("digest", pbjson::private::base64::encode(&self.digest).as_str())?; } if self.sender_time_ns != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("senderTimeNs", ToString::to_string(&self.sender_time_ns).as_str())?; } struct_ser.end() @@ -955,10 +960,12 @@ impl serde::Serialize for QueryRequest { } if self.start_time_ns != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("startTimeNs", ToString::to_string(&self.start_time_ns).as_str())?; } if self.end_time_ns != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("endTimeNs", ToString::to_string(&self.end_time_ns).as_str())?; } if let Some(v) = self.paging_info.as_ref() { @@ -1450,6 +1457,7 @@ impl serde::Serialize for Token { } if !self.auth_data_bytes.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("authDataBytes", pbjson::private::base64::encode(&self.auth_data_bytes).as_str())?; } if let Some(v) = self.auth_data_signature.as_ref() { diff --git a/xmtp_proto/src/gen/xmtp.message_api.v1.tonic.rs b/xmtp_proto/src/gen/xmtp.message_api.v1.tonic.rs index 771e0335f..5876f968a 100644 --- a/xmtp_proto/src/gen/xmtp.message_api.v1.tonic.rs +++ b/xmtp_proto/src/gen/xmtp.message_api.v1.tonic.rs @@ -1,6 +1,6 @@ // @generated /// Generated client implementations. -#[cfg(feature = "tonic")] +#[cfg(not(target_arch = "wasm32"))] pub mod message_api_client { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; @@ -237,7 +237,7 @@ pub mod message_api_client { } } /// Generated server implementations. -#[cfg(feature = "tonic")] +#[cfg(not(target_arch = "wasm32"))] pub mod message_api_server { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; @@ -295,19 +295,17 @@ pub mod message_api_server { } #[derive(Debug)] pub struct MessageApiServer { - inner: _Inner, + inner: Arc, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, max_decoding_message_size: Option, max_encoding_message_size: Option, } - struct _Inner(Arc); impl MessageApiServer { 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(), @@ -370,7 +368,6 @@ pub mod message_api_server { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { - let inner = self.inner.clone(); match req.uri().path() { "/xmtp.message_api.v1.MessageApi/Publish" => { #[allow(non_camel_case_types)] @@ -401,7 +398,6 @@ pub mod message_api_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 = PublishSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -448,7 +444,6 @@ pub mod message_api_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 = SubscribeSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -497,7 +492,6 @@ pub mod message_api_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 = Subscribe2Svc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -544,7 +538,6 @@ pub mod message_api_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 = SubscribeAllSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -588,7 +581,6 @@ pub mod message_api_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 = QuerySvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -634,7 +626,6 @@ pub mod message_api_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 = BatchQuerySvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -656,8 +647,11 @@ pub mod message_api_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(), ) @@ -678,16 +672,6 @@ pub mod message_api_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 MessageApiServer { const NAME: &'static str = "xmtp.message_api.v1.MessageApi"; } diff --git a/xmtp_proto/src/gen/xmtp.message_contents.rs b/xmtp_proto/src/gen/xmtp.message_contents.rs index 1d3966343..823855286 100644 --- a/xmtp_proto/src/gen/xmtp.message_contents.rs +++ b/xmtp_proto/src/gen/xmtp.message_contents.rs @@ -1,4 +1,5 @@ // @generated +// This file is @generated by prost-build. /// Signature represents a generalized public key signature, /// defined as a union to support cryptographic algorithm agility. #[allow(clippy::derive_partial_eq_without_eq)] diff --git a/xmtp_proto/src/gen/xmtp.message_contents.serde.rs b/xmtp_proto/src/gen/xmtp.message_contents.serde.rs index 8df3e631b..279816e33 100644 --- a/xmtp_proto/src/gen/xmtp.message_contents.serde.rs +++ b/xmtp_proto/src/gen/xmtp.message_contents.serde.rs @@ -116,14 +116,17 @@ impl serde::Serialize for ciphertext::Aes256gcmHkdfsha256 { let mut struct_ser = serializer.serialize_struct("xmtp.message_contents.Ciphertext.Aes256gcmHkdfsha256", len)?; if !self.hkdf_salt.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("hkdfSalt", pbjson::private::base64::encode(&self.hkdf_salt).as_str())?; } if !self.gcm_nonce.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("gcmNonce", pbjson::private::base64::encode(&self.gcm_nonce).as_str())?; } if !self.payload.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("payload", pbjson::private::base64::encode(&self.payload).as_str())?; } struct_ser.end() @@ -526,6 +529,7 @@ impl serde::Serialize for ConsentProofPayload { } if self.timestamp != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("timestamp", ToString::to_string(&self.timestamp).as_str())?; } if self.payload_version != 0 { @@ -1180,6 +1184,7 @@ impl serde::Serialize for ConversationReference { } if self.created_ns != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("createdNs", ToString::to_string(&self.created_ns).as_str())?; } if let Some(v) = self.context.as_ref() { @@ -1360,6 +1365,7 @@ impl serde::Serialize for DecodedMessage { } if self.sent_ns != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("sentNs", ToString::to_string(&self.sent_ns).as_str())?; } if !self.content_topic.is_empty() { @@ -1370,6 +1376,7 @@ impl serde::Serialize for DecodedMessage { } if !self.content_bytes.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("contentBytes", pbjson::private::base64::encode(&self.content_bytes).as_str())?; } struct_ser.end() @@ -1551,6 +1558,7 @@ impl serde::Serialize for EciesMessage { match v { ecies_message::Version::V1(v) => { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("v1", pbjson::private::base64::encode(&v).as_str())?; } } @@ -1671,6 +1679,7 @@ impl serde::Serialize for EncodedContent { } if !self.content.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("content", pbjson::private::base64::encode(&self.content).as_str())?; } struct_ser.end() @@ -1910,6 +1919,7 @@ impl serde::Serialize for EncryptedPrivateKeyBundleV1 { let mut struct_ser = serializer.serialize_struct("xmtp.message_contents.EncryptedPrivateKeyBundleV1", len)?; if !self.wallet_pre_key.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("walletPreKey", pbjson::private::base64::encode(&self.wallet_pre_key).as_str())?; } if let Some(v) = self.ciphertext.as_ref() { @@ -2031,6 +2041,7 @@ impl serde::Serialize for FrameAction { } if !self.action_body.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("actionBody", pbjson::private::base64::encode(&self.action_body).as_str())?; } struct_ser.end() @@ -2179,6 +2190,7 @@ impl serde::Serialize for FrameActionBody { } if self.timestamp != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("timestamp", ToString::to_string(&self.timestamp).as_str())?; } if !self.opaque_conversation_identifier.is_empty() { @@ -2538,6 +2550,7 @@ impl serde::Serialize for invitation_v1::Aes256gcmHkdfsha256 { let mut struct_ser = serializer.serialize_struct("xmtp.message_contents.InvitationV1.Aes256gcmHkdfsha256", len)?; if !self.key_material.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("keyMaterial", pbjson::private::base64::encode(&self.key_material).as_str())?; } struct_ser.end() @@ -2865,6 +2878,7 @@ impl serde::Serialize for MessageHeaderV1 { } if self.timestamp != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("timestamp", ToString::to_string(&self.timestamp).as_str())?; } struct_ser.end() @@ -2984,6 +2998,7 @@ impl serde::Serialize for MessageHeaderV2 { let mut struct_ser = serializer.serialize_struct("xmtp.message_contents.MessageHeaderV2", len)?; if self.created_ns != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("createdNs", ToString::to_string(&self.created_ns).as_str())?; } if !self.topic.is_empty() { @@ -3096,6 +3111,7 @@ impl serde::Serialize for MessageV1 { let mut struct_ser = serializer.serialize_struct("xmtp.message_contents.MessageV1", len)?; if !self.header_bytes.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("headerBytes", pbjson::private::base64::encode(&self.header_bytes).as_str())?; } if let Some(v) = self.ciphertext.as_ref() { @@ -3214,6 +3230,7 @@ impl serde::Serialize for MessageV2 { let mut struct_ser = serializer.serialize_struct("xmtp.message_contents.MessageV2", len)?; if !self.header_bytes.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("headerBytes", pbjson::private::base64::encode(&self.header_bytes).as_str())?; } if let Some(v) = self.ciphertext.as_ref() { @@ -3221,6 +3238,7 @@ impl serde::Serialize for MessageV2 { } if let Some(v) = self.sender_hmac.as_ref() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("senderHmac", pbjson::private::base64::encode(&v).as_str())?; } if let Some(v) = self.should_push.as_ref() { @@ -3362,6 +3380,7 @@ impl serde::Serialize for PrivateKey { let mut struct_ser = serializer.serialize_struct("xmtp.message_contents.PrivateKey", len)?; if self.timestamp != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("timestamp", ToString::to_string(&self.timestamp).as_str())?; } if let Some(v) = self.public_key.as_ref() { @@ -3490,6 +3509,7 @@ impl serde::Serialize for private_key::Secp256k1 { let mut struct_ser = serializer.serialize_struct("xmtp.message_contents.PrivateKey.Secp256k1", len)?; if !self.bytes.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("bytes", pbjson::private::base64::encode(&self.bytes).as_str())?; } struct_ser.end() @@ -4734,6 +4754,7 @@ impl serde::Serialize for PublicKey { let mut struct_ser = serializer.serialize_struct("xmtp.message_contents.PublicKey", len)?; if self.timestamp != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("timestamp", ToString::to_string(&self.timestamp).as_str())?; } if let Some(v) = self.signature.as_ref() { @@ -4862,6 +4883,7 @@ impl serde::Serialize for public_key::Secp256k1Uncompressed { let mut struct_ser = serializer.serialize_struct("xmtp.message_contents.PublicKey.Secp256k1Uncompressed", len)?; if !self.bytes.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("bytes", pbjson::private::base64::encode(&self.bytes).as_str())?; } struct_ser.end() @@ -5174,6 +5196,7 @@ impl serde::Serialize for SealedInvitationHeaderV1 { } if self.created_ns != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("createdNs", ToString::to_string(&self.created_ns).as_str())?; } struct_ser.end() @@ -5294,6 +5317,7 @@ impl serde::Serialize for SealedInvitationV1 { let mut struct_ser = serializer.serialize_struct("xmtp.message_contents.SealedInvitationV1", len)?; if !self.header_bytes.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("headerBytes", pbjson::private::base64::encode(&self.header_bytes).as_str())?; } if let Some(v) = self.ciphertext.as_ref() { @@ -5517,6 +5541,7 @@ impl serde::Serialize for signature::EcdsaCompact { let mut struct_ser = serializer.serialize_struct("xmtp.message_contents.Signature.ECDSACompact", len)?; if !self.bytes.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("bytes", pbjson::private::base64::encode(&self.bytes).as_str())?; } if self.recovery != 0 { @@ -5630,6 +5655,7 @@ impl serde::Serialize for signature::WalletEcdsaCompact { let mut struct_ser = serializer.serialize_struct("xmtp.message_contents.Signature.WalletECDSACompact", len)?; if !self.bytes.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("bytes", pbjson::private::base64::encode(&self.bytes).as_str())?; } if self.recovery != 0 { @@ -5746,6 +5772,7 @@ impl serde::Serialize for SignedContent { let mut struct_ser = serializer.serialize_struct("xmtp.message_contents.SignedContent", len)?; if !self.payload.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("payload", pbjson::private::base64::encode(&self.payload).as_str())?; } if let Some(v) = self.sender.as_ref() { @@ -5871,6 +5898,7 @@ impl serde::Serialize for SignedEciesCiphertext { let mut struct_ser = serializer.serialize_struct("xmtp.message_contents.SignedEciesCiphertext", len)?; if !self.ecies_bytes.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("eciesBytes", pbjson::private::base64::encode(&self.ecies_bytes).as_str())?; } if let Some(v) = self.signature.as_ref() { @@ -5989,18 +6017,22 @@ impl serde::Serialize for signed_ecies_ciphertext::Ecies { let mut struct_ser = serializer.serialize_struct("xmtp.message_contents.SignedEciesCiphertext.Ecies", len)?; if !self.ephemeral_public_key.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("ephemeralPublicKey", pbjson::private::base64::encode(&self.ephemeral_public_key).as_str())?; } if !self.iv.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("iv", pbjson::private::base64::encode(&self.iv).as_str())?; } if !self.mac.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("mac", pbjson::private::base64::encode(&self.mac).as_str())?; } if !self.ciphertext.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("ciphertext", pbjson::private::base64::encode(&self.ciphertext).as_str())?; } struct_ser.end() @@ -6138,6 +6170,7 @@ impl serde::Serialize for SignedPayload { let mut struct_ser = serializer.serialize_struct("xmtp.message_contents.SignedPayload", len)?; if !self.payload.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("payload", pbjson::private::base64::encode(&self.payload).as_str())?; } if let Some(v) = self.signature.as_ref() { @@ -6252,6 +6285,7 @@ impl serde::Serialize for SignedPrivateKey { let mut struct_ser = serializer.serialize_struct("xmtp.message_contents.SignedPrivateKey", len)?; if self.created_ns != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("createdNs", ToString::to_string(&self.created_ns).as_str())?; } if let Some(v) = self.public_key.as_ref() { @@ -6381,6 +6415,7 @@ impl serde::Serialize for signed_private_key::Secp256k1 { let mut struct_ser = serializer.serialize_struct("xmtp.message_contents.SignedPrivateKey.Secp256k1", len)?; if !self.bytes.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("bytes", pbjson::private::base64::encode(&self.bytes).as_str())?; } struct_ser.end() @@ -6478,6 +6513,7 @@ impl serde::Serialize for SignedPublicKey { let mut struct_ser = serializer.serialize_struct("xmtp.message_contents.SignedPublicKey", len)?; if !self.key_bytes.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("keyBytes", pbjson::private::base64::encode(&self.key_bytes).as_str())?; } if let Some(v) = self.signature.as_ref() { @@ -6700,6 +6736,7 @@ impl serde::Serialize for UnsignedPublicKey { let mut struct_ser = serializer.serialize_struct("xmtp.message_contents.UnsignedPublicKey", len)?; if self.created_ns != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("createdNs", ToString::to_string(&self.created_ns).as_str())?; } if let Some(v) = self.union.as_ref() { @@ -6815,6 +6852,7 @@ impl serde::Serialize for unsigned_public_key::Secp256k1Uncompressed { let mut struct_ser = serializer.serialize_struct("xmtp.message_contents.UnsignedPublicKey.Secp256k1Uncompressed", len)?; if !self.bytes.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("bytes", pbjson::private::base64::encode(&self.bytes).as_str())?; } struct_ser.end() diff --git a/xmtp_proto/src/gen/xmtp.mls.api.v1.rs b/xmtp_proto/src/gen/xmtp.mls.api.v1.rs index f82343b35..203e98980 100644 --- a/xmtp_proto/src/gen/xmtp.mls.api.v1.rs +++ b/xmtp_proto/src/gen/xmtp.mls.api.v1.rs @@ -1,4 +1,5 @@ // @generated +// This file is @generated by prost-build. /// Full representation of a welcome message #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -274,7 +275,7 @@ pub mod get_identity_updates_response { } /// Pagination config for queries #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct PagingInfo { #[prost(enumeration="SortDirection", tag="1")] pub direction: i32, diff --git a/xmtp_proto/src/gen/xmtp.mls.api.v1.serde.rs b/xmtp_proto/src/gen/xmtp.mls.api.v1.serde.rs index 93a7ceaed..fd4aa1e43 100644 --- a/xmtp_proto/src/gen/xmtp.mls.api.v1.serde.rs +++ b/xmtp_proto/src/gen/xmtp.mls.api.v1.serde.rs @@ -200,6 +200,7 @@ impl serde::Serialize for fetch_key_packages_response::KeyPackage { let mut struct_ser = serializer.serialize_struct("xmtp.mls.api.v1.FetchKeyPackagesResponse.KeyPackage", len)?; if !self.key_package_tls_serialized.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("keyPackageTlsSerialized", pbjson::private::base64::encode(&self.key_package_tls_serialized).as_str())?; } struct_ser.end() @@ -301,6 +302,7 @@ impl serde::Serialize for GetIdentityUpdatesRequest { } if self.start_time_ns != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("startTimeNs", ToString::to_string(&self.start_time_ns).as_str())?; } struct_ser.end() @@ -502,10 +504,12 @@ impl serde::Serialize for get_identity_updates_response::NewInstallationUpdate { let mut struct_ser = serializer.serialize_struct("xmtp.mls.api.v1.GetIdentityUpdatesResponse.NewInstallationUpdate", len)?; if !self.installation_key.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("installationKey", pbjson::private::base64::encode(&self.installation_key).as_str())?; } if !self.credential_identity.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("credentialIdentity", pbjson::private::base64::encode(&self.credential_identity).as_str())?; } struct_ser.end() @@ -615,6 +619,7 @@ impl serde::Serialize for get_identity_updates_response::RevokedInstallationUpda let mut struct_ser = serializer.serialize_struct("xmtp.mls.api.v1.GetIdentityUpdatesResponse.RevokedInstallationUpdate", len)?; if !self.installation_key.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("installationKey", pbjson::private::base64::encode(&self.installation_key).as_str())?; } struct_ser.end() @@ -713,6 +718,7 @@ impl serde::Serialize for get_identity_updates_response::Update { let mut struct_ser = serializer.serialize_struct("xmtp.mls.api.v1.GetIdentityUpdatesResponse.Update", len)?; if self.timestamp_ns != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("timestampNs", ToString::to_string(&self.timestamp_ns).as_str())?; } if let Some(v) = self.kind.as_ref() { @@ -1041,22 +1047,27 @@ impl serde::Serialize for group_message::V1 { let mut struct_ser = serializer.serialize_struct("xmtp.mls.api.v1.GroupMessage.V1", len)?; if self.id != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("id", ToString::to_string(&self.id).as_str())?; } if self.created_ns != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("createdNs", ToString::to_string(&self.created_ns).as_str())?; } if !self.group_id.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("groupId", pbjson::private::base64::encode(&self.group_id).as_str())?; } if !self.data.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("data", pbjson::private::base64::encode(&self.data).as_str())?; } if !self.sender_hmac.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("senderHmac", pbjson::private::base64::encode(&self.sender_hmac).as_str())?; } struct_ser.end() @@ -1305,10 +1316,12 @@ impl serde::Serialize for group_message_input::V1 { let mut struct_ser = serializer.serialize_struct("xmtp.mls.api.v1.GroupMessageInput.V1", len)?; if !self.data.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("data", pbjson::private::base64::encode(&self.data).as_str())?; } if !self.sender_hmac.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("senderHmac", pbjson::private::base64::encode(&self.sender_hmac).as_str())?; } struct_ser.end() @@ -1417,6 +1430,7 @@ impl serde::Serialize for KeyPackageUpload { let mut struct_ser = serializer.serialize_struct("xmtp.mls.api.v1.KeyPackageUpload", len)?; if !self.key_package_tls_serialized.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("keyPackageTlsSerialized", pbjson::private::base64::encode(&self.key_package_tls_serialized).as_str())?; } struct_ser.end() @@ -1526,6 +1540,7 @@ impl serde::Serialize for PagingInfo { } if self.id_cursor != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("idCursor", ToString::to_string(&self.id_cursor).as_str())?; } struct_ser.end() @@ -1648,6 +1663,7 @@ impl serde::Serialize for QueryGroupMessagesRequest { let mut struct_ser = serializer.serialize_struct("xmtp.mls.api.v1.QueryGroupMessagesRequest", len)?; if !self.group_id.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("groupId", pbjson::private::base64::encode(&self.group_id).as_str())?; } if let Some(v) = self.paging_info.as_ref() { @@ -1870,6 +1886,7 @@ impl serde::Serialize for QueryWelcomeMessagesRequest { let mut struct_ser = serializer.serialize_struct("xmtp.mls.api.v1.QueryWelcomeMessagesRequest", len)?; if !self.installation_key.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("installationKey", pbjson::private::base64::encode(&self.installation_key).as_str())?; } if let Some(v) = self.paging_info.as_ref() { @@ -2199,6 +2216,7 @@ impl serde::Serialize for RegisterInstallationResponse { let mut struct_ser = serializer.serialize_struct("xmtp.mls.api.v1.RegisterInstallationResponse", len)?; if !self.installation_key.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("installationKey", pbjson::private::base64::encode(&self.installation_key).as_str())?; } struct_ser.end() @@ -2297,6 +2315,7 @@ impl serde::Serialize for RevokeInstallationRequest { let mut struct_ser = serializer.serialize_struct("xmtp.mls.api.v1.RevokeInstallationRequest", len)?; if !self.installation_key.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("installationKey", pbjson::private::base64::encode(&self.installation_key).as_str())?; } if let Some(v) = self.wallet_signature.as_ref() { @@ -2757,10 +2776,12 @@ impl serde::Serialize for subscribe_group_messages_request::Filter { let mut struct_ser = serializer.serialize_struct("xmtp.mls.api.v1.SubscribeGroupMessagesRequest.Filter", len)?; if !self.group_id.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("groupId", pbjson::private::base64::encode(&self.group_id).as_str())?; } if self.id_cursor != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("idCursor", ToString::to_string(&self.id_cursor).as_str())?; } struct_ser.end() @@ -2964,10 +2985,12 @@ impl serde::Serialize for subscribe_welcome_messages_request::Filter { let mut struct_ser = serializer.serialize_struct("xmtp.mls.api.v1.SubscribeWelcomeMessagesRequest.Filter", len)?; if !self.installation_key.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("installationKey", pbjson::private::base64::encode(&self.installation_key).as_str())?; } if self.id_cursor != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("idCursor", ToString::to_string(&self.id_cursor).as_str())?; } struct_ser.end() @@ -3295,22 +3318,27 @@ impl serde::Serialize for welcome_message::V1 { let mut struct_ser = serializer.serialize_struct("xmtp.mls.api.v1.WelcomeMessage.V1", len)?; if self.id != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("id", ToString::to_string(&self.id).as_str())?; } if self.created_ns != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("createdNs", ToString::to_string(&self.created_ns).as_str())?; } if !self.installation_key.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("installationKey", pbjson::private::base64::encode(&self.installation_key).as_str())?; } if !self.data.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("data", pbjson::private::base64::encode(&self.data).as_str())?; } if !self.hpke_public_key.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("hpkePublicKey", pbjson::private::base64::encode(&self.hpke_public_key).as_str())?; } struct_ser.end() @@ -3562,14 +3590,17 @@ impl serde::Serialize for welcome_message_input::V1 { let mut struct_ser = serializer.serialize_struct("xmtp.mls.api.v1.WelcomeMessageInput.V1", len)?; if !self.installation_key.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("installationKey", pbjson::private::base64::encode(&self.installation_key).as_str())?; } if !self.data.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("data", pbjson::private::base64::encode(&self.data).as_str())?; } if !self.hpke_public_key.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("hpkePublicKey", pbjson::private::base64::encode(&self.hpke_public_key).as_str())?; } struct_ser.end() diff --git a/xmtp_proto/src/gen/xmtp.mls.api.v1.tonic.rs b/xmtp_proto/src/gen/xmtp.mls.api.v1.tonic.rs index 9afd5d202..72b522e23 100644 --- a/xmtp_proto/src/gen/xmtp.mls.api.v1.tonic.rs +++ b/xmtp_proto/src/gen/xmtp.mls.api.v1.tonic.rs @@ -1,6 +1,6 @@ // @generated /// Generated client implementations. -#[cfg(feature = "tonic")] +#[cfg(not(target_arch = "wasm32"))] pub mod mls_api_client { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; @@ -361,7 +361,7 @@ pub mod mls_api_client { } } /// Generated server implementations. -#[cfg(feature = "tonic")] +#[cfg(not(target_arch = "wasm32"))] pub mod mls_api_server { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; @@ -448,19 +448,17 @@ pub mod mls_api_server { } #[derive(Debug)] pub struct MlsApiServer { - inner: _Inner, + inner: Arc, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, max_decoding_message_size: Option, max_encoding_message_size: Option, } - struct _Inner(Arc); impl MlsApiServer { 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(), @@ -523,7 +521,6 @@ pub mod mls_api_server { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { - let inner = self.inner.clone(); match req.uri().path() { "/xmtp.mls.api.v1.MlsApi/SendGroupMessages" => { #[allow(non_camel_case_types)] @@ -554,7 +551,6 @@ pub mod mls_api_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 = SendGroupMessagesSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -600,7 +596,6 @@ pub mod mls_api_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 = SendWelcomeMessagesSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -646,7 +641,6 @@ pub mod mls_api_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 = RegisterInstallationSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -692,7 +686,6 @@ pub mod mls_api_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 = UploadKeyPackageSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -738,7 +731,6 @@ pub mod mls_api_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 = FetchKeyPackagesSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -784,7 +776,6 @@ pub mod mls_api_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 = RevokeInstallationSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -830,7 +821,6 @@ pub mod mls_api_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 = GetIdentityUpdatesSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -876,7 +866,6 @@ pub mod mls_api_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 = QueryGroupMessagesSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -922,7 +911,6 @@ pub mod mls_api_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 = QueryWelcomeMessagesSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -971,7 +959,6 @@ pub mod mls_api_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 = SubscribeGroupMessagesSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1022,7 +1009,6 @@ pub mod mls_api_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 = SubscribeWelcomeMessagesSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -1044,8 +1030,11 @@ pub mod mls_api_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(), ) @@ -1066,16 +1055,6 @@ pub mod mls_api_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 MlsApiServer { const NAME: &'static str = "xmtp.mls.api.v1.MlsApi"; } diff --git a/xmtp_proto/src/gen/xmtp.mls.database.rs b/xmtp_proto/src/gen/xmtp.mls.database.rs index d8334b7e2..d78b25e87 100644 --- a/xmtp_proto/src/gen/xmtp.mls.database.rs +++ b/xmtp_proto/src/gen/xmtp.mls.database.rs @@ -1,4 +1,5 @@ // @generated +// This file is @generated by prost-build. /// The data required to publish a message #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] diff --git a/xmtp_proto/src/gen/xmtp.mls.database.serde.rs b/xmtp_proto/src/gen/xmtp.mls.database.serde.rs index de5526005..53757c57c 100644 --- a/xmtp_proto/src/gen/xmtp.mls.database.serde.rs +++ b/xmtp_proto/src/gen/xmtp.mls.database.serde.rs @@ -842,10 +842,12 @@ impl serde::Serialize for post_commit_action::Installation { let mut struct_ser = serializer.serialize_struct("xmtp.mls.database.PostCommitAction.Installation", len)?; if !self.installation_key.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("installationKey", pbjson::private::base64::encode(&self.installation_key).as_str())?; } if !self.hpke_public_key.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("hpkePublicKey", pbjson::private::base64::encode(&self.hpke_public_key).as_str())?; } struct_ser.end() @@ -961,6 +963,7 @@ impl serde::Serialize for post_commit_action::SendWelcomes { } if !self.welcome_message.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("welcomeMessage", pbjson::private::base64::encode(&self.welcome_message).as_str())?; } struct_ser.end() @@ -1351,6 +1354,7 @@ impl serde::Serialize for send_message_data::V1 { let mut struct_ser = serializer.serialize_struct("xmtp.mls.database.SendMessageData.V1", len)?; if !self.payload_bytes.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("payloadBytes", pbjson::private::base64::encode(&self.payload_bytes).as_str())?; } struct_ser.end() diff --git a/xmtp_proto/src/gen/xmtp.mls.message_contents.rs b/xmtp_proto/src/gen/xmtp.mls.message_contents.rs index 79aed020b..64881f6f3 100644 --- a/xmtp_proto/src/gen/xmtp.mls.message_contents.rs +++ b/xmtp_proto/src/gen/xmtp.mls.message_contents.rs @@ -1,4 +1,5 @@ // @generated +// This file is @generated by prost-build. /// Used for "Grant Messaging Access" associations #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] diff --git a/xmtp_proto/src/gen/xmtp.mls.message_contents.serde.rs b/xmtp_proto/src/gen/xmtp.mls.message_contents.serde.rs index 22304194c..6b8b584f8 100644 --- a/xmtp_proto/src/gen/xmtp.mls.message_contents.serde.rs +++ b/xmtp_proto/src/gen/xmtp.mls.message_contents.serde.rs @@ -387,10 +387,12 @@ impl serde::Serialize for CredentialRevocation { match v { credential_revocation::PublicKey::InstallationKey(v) => { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("installationKey", pbjson::private::base64::encode(&v).as_str())?; } credential_revocation::PublicKey::UnsignedLegacyCreateIdentityKey(v) => { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("unsignedLegacyCreateIdentityKey", pbjson::private::base64::encode(&v).as_str())?; } } @@ -626,6 +628,7 @@ impl serde::Serialize for EdDsaSignature { let mut struct_ser = serializer.serialize_struct("xmtp.mls.message_contents.EdDsaSignature", len)?; if !self.bytes.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("bytes", pbjson::private::base64::encode(&self.bytes).as_str())?; } struct_ser.end() @@ -746,6 +749,7 @@ impl serde::Serialize for EncodedContent { } if !self.content.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("content", pbjson::private::base64::encode(&self.content).as_str())?; } struct_ser.end() @@ -906,6 +910,7 @@ impl serde::Serialize for GrantMessagingAccessAssociation { } if self.created_ns != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("createdNs", ToString::to_string(&self.created_ns).as_str())?; } struct_ser.end() @@ -2825,6 +2830,7 @@ impl serde::Serialize for MessageHistoryKeyType { match v { message_history_key_type::Key::Chacha20Poly1305(v) => { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("chacha20Poly1305", pbjson::private::base64::encode(&v).as_str())?; } } @@ -3547,6 +3553,7 @@ impl serde::Serialize for MlsCredential { let mut struct_ser = serializer.serialize_struct("xmtp.mls.message_contents.MlsCredential", len)?; if !self.installation_public_key.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("installationPublicKey", pbjson::private::base64::encode(&self.installation_public_key).as_str())?; } if let Some(v) = self.association.as_ref() { @@ -4172,6 +4179,7 @@ impl serde::Serialize for plaintext_envelope::V1 { let mut struct_ser = serializer.serialize_struct("xmtp.mls.message_contents.PlaintextEnvelope.V1", len)?; if !self.content.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("content", pbjson::private::base64::encode(&self.content).as_str())?; } if !self.idempotency_key.is_empty() { @@ -4289,6 +4297,7 @@ impl serde::Serialize for plaintext_envelope::V2 { match v { plaintext_envelope::v2::MessageType::Content(v) => { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("content", pbjson::private::base64::encode(&v).as_str())?; } plaintext_envelope::v2::MessageType::Request(v) => { @@ -4605,6 +4614,7 @@ impl serde::Serialize for RecoverableEcdsaSignature { let mut struct_ser = serializer.serialize_struct("xmtp.mls.message_contents.RecoverableEcdsaSignature", len)?; if !self.bytes.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("bytes", pbjson::private::base64::encode(&self.bytes).as_str())?; } struct_ser.end() @@ -4719,6 +4729,7 @@ impl serde::Serialize for RevokeMessagingAccessAssociation { } if self.created_ns != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("createdNs", ToString::to_string(&self.created_ns).as_str())?; } struct_ser.end() diff --git a/xmtp_proto/src/gen/xmtp.mls_validation.v1.rs b/xmtp_proto/src/gen/xmtp.mls_validation.v1.rs index 185633227..c1a1c1bdf 100644 --- a/xmtp_proto/src/gen/xmtp.mls_validation.v1.rs +++ b/xmtp_proto/src/gen/xmtp.mls_validation.v1.rs @@ -1,4 +1,5 @@ // @generated +// This file is @generated by prost-build. /// Validates a Inbox-ID Key Package Type #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] diff --git a/xmtp_proto/src/gen/xmtp.mls_validation.v1.serde.rs b/xmtp_proto/src/gen/xmtp.mls_validation.v1.serde.rs index c27c9243b..599dc577b 100644 --- a/xmtp_proto/src/gen/xmtp.mls_validation.v1.serde.rs +++ b/xmtp_proto/src/gen/xmtp.mls_validation.v1.serde.rs @@ -325,6 +325,7 @@ impl serde::Serialize for validate_group_messages_request::GroupMessage { let mut struct_ser = serializer.serialize_struct("xmtp.mls_validation.v1.ValidateGroupMessagesRequest.GroupMessage", len)?; if !self.group_message_bytes_tls_serialized.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("groupMessageBytesTlsSerialized", pbjson::private::base64::encode(&self.group_message_bytes_tls_serialized).as_str())?; } struct_ser.end() @@ -751,10 +752,12 @@ impl serde::Serialize for validate_inbox_id_key_packages_response::Response { } if !self.installation_public_key.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("installationPublicKey", pbjson::private::base64::encode(&self.installation_public_key).as_str())?; } if self.expiration != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("expiration", ToString::to_string(&self.expiration).as_str())?; } struct_ser.end() @@ -998,6 +1001,7 @@ impl serde::Serialize for validate_inbox_ids_request::ValidationRequest { } if !self.installation_public_key.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("installationPublicKey", pbjson::private::base64::encode(&self.installation_public_key).as_str())?; } if !self.identity_updates.is_empty() { @@ -1433,6 +1437,7 @@ impl serde::Serialize for validate_key_packages_request::KeyPackage { let mut struct_ser = serializer.serialize_struct("xmtp.mls_validation.v1.ValidateKeyPackagesRequest.KeyPackage", len)?; if !self.key_package_bytes_tls_serialized.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("keyPackageBytesTlsSerialized", pbjson::private::base64::encode(&self.key_package_bytes_tls_serialized).as_str())?; } if self.is_inbox_id_credential { @@ -1655,6 +1660,7 @@ impl serde::Serialize for validate_key_packages_response::ValidationResponse { } if !self.installation_id.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("installationId", pbjson::private::base64::encode(&self.installation_id).as_str())?; } if !self.account_address.is_empty() { @@ -1662,10 +1668,12 @@ impl serde::Serialize for validate_key_packages_response::ValidationResponse { } if !self.credential_identity_bytes.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("credentialIdentityBytes", pbjson::private::base64::encode(&self.credential_identity_bytes).as_str())?; } if self.expiration != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("expiration", ToString::to_string(&self.expiration).as_str())?; } struct_ser.end() diff --git a/xmtp_proto/src/gen/xmtp.mls_validation.v1.tonic.rs b/xmtp_proto/src/gen/xmtp.mls_validation.v1.tonic.rs index 09d1b7b63..706b7c66f 100644 --- a/xmtp_proto/src/gen/xmtp.mls_validation.v1.tonic.rs +++ b/xmtp_proto/src/gen/xmtp.mls_validation.v1.tonic.rs @@ -1,6 +1,6 @@ // @generated /// Generated client implementations. -#[cfg(feature = "tonic")] +#[cfg(not(target_arch = "wasm32"))] pub mod validation_api_client { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; @@ -238,7 +238,7 @@ pub mod validation_api_client { } } /// Generated server implementations. -#[cfg(feature = "tonic")] +#[cfg(not(target_arch = "wasm32"))] pub mod validation_api_server { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; @@ -283,19 +283,17 @@ pub mod validation_api_server { } #[derive(Debug)] pub struct ValidationApiServer { - inner: _Inner, + inner: Arc, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, max_decoding_message_size: Option, max_encoding_message_size: Option, } - struct _Inner(Arc); impl ValidationApiServer { 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(), @@ -358,7 +356,6 @@ pub mod validation_api_server { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { - let inner = self.inner.clone(); match req.uri().path() { "/xmtp.mls_validation.v1.ValidationApi/ValidateKeyPackages" => { #[allow(non_camel_case_types)] @@ -390,7 +387,6 @@ pub mod validation_api_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 = ValidateKeyPackagesSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -440,7 +436,6 @@ pub mod validation_api_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 = ValidateGroupMessagesSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -487,7 +482,6 @@ pub mod validation_api_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 = GetAssociationStateSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -537,7 +531,6 @@ pub mod validation_api_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 = ValidateInboxIdKeyPackagesSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -584,7 +577,6 @@ pub mod validation_api_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 = ValidateInboxIdsSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -606,8 +598,11 @@ pub mod validation_api_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(), ) @@ -628,16 +623,6 @@ pub mod validation_api_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 ValidationApiServer { const NAME: &'static str = "xmtp.mls_validation.v1.ValidationApi"; } diff --git a/xmtp_proto/src/gen/xmtp.xmtpv4.rs b/xmtp_proto/src/gen/xmtp.xmtpv4.rs index 02bf3e7c3..50f7a5533 100644 --- a/xmtp_proto/src/gen/xmtp.xmtpv4.rs +++ b/xmtp_proto/src/gen/xmtp.xmtpv4.rs @@ -1,4 +1,5 @@ // @generated +// This file is @generated by prost-build. /// Data visible to the server that has been authenticated by the client. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -59,7 +60,7 @@ pub struct UnsignedOriginatorEnvelope { } /// An alternative to a signature for blockchain payloads #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Message)] +#[derive(Clone, Copy, PartialEq, ::prost::Message)] pub struct BlockchainProof { #[prost(uint64, tag="1")] pub block_number: u64, @@ -127,7 +128,7 @@ pub mod envelopes_query { OriginatorId(u32), } #[allow(clippy::derive_partial_eq_without_eq)] -#[derive(Clone, PartialEq, ::prost::Oneof)] +#[derive(Clone, Copy, PartialEq, ::prost::Oneof)] pub enum LastSeen { #[prost(uint64, tag="3")] OriginatorSid(u64), diff --git a/xmtp_proto/src/gen/xmtp.xmtpv4.serde.rs b/xmtp_proto/src/gen/xmtp.xmtpv4.serde.rs index fe6f55447..59ddc3e60 100644 --- a/xmtp_proto/src/gen/xmtp.xmtpv4.serde.rs +++ b/xmtp_proto/src/gen/xmtp.xmtpv4.serde.rs @@ -22,6 +22,7 @@ impl serde::Serialize for AuthenticatedData { } if !self.target_topic.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("targetTopic", pbjson::private::base64::encode(&self.target_topic).as_str())?; } if !self.last_originator_sids.is_empty() { @@ -425,6 +426,7 @@ impl serde::Serialize for BlockchainProof { let mut struct_ser = serializer.serialize_struct("xmtp.xmtpv4.BlockchainProof", len)?; if self.block_number != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("blockNumber", ToString::to_string(&self.block_number).as_str())?; } if self.publisher_id != 0 { @@ -712,6 +714,7 @@ impl serde::Serialize for EnvelopesQuery { match v { envelopes_query::Filter::Topic(v) => { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("topic", pbjson::private::base64::encode(&v).as_str())?; } envelopes_query::Filter::OriginatorId(v) => { @@ -723,10 +726,12 @@ impl serde::Serialize for EnvelopesQuery { match v { envelopes_query::LastSeen::OriginatorSid(v) => { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("originatorSid", ToString::to_string(&v).as_str())?; } envelopes_query::LastSeen::GatewaySid(v) => { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("gatewaySid", ToString::to_string(&v).as_str())?; } } @@ -856,6 +861,7 @@ impl serde::Serialize for GatewayEnvelope { let mut struct_ser = serializer.serialize_struct("xmtp.xmtpv4.GatewayEnvelope", len)?; if self.gateway_sid != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("gatewaySid", ToString::to_string(&self.gateway_sid).as_str())?; } if let Some(v) = self.originator_envelope.as_ref() { @@ -1159,6 +1165,7 @@ impl serde::Serialize for OriginatorEnvelope { let mut struct_ser = serializer.serialize_struct("xmtp.xmtpv4.OriginatorEnvelope", len)?; if !self.unsigned_originator_envelope.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("unsignedOriginatorEnvelope", pbjson::private::base64::encode(&self.unsigned_originator_envelope).as_str())?; } if let Some(v) = self.proof.as_ref() { @@ -1291,6 +1298,7 @@ impl serde::Serialize for PayerEnvelope { let mut struct_ser = serializer.serialize_struct("xmtp.xmtpv4.PayerEnvelope", len)?; if !self.unsigned_client_envelope.is_empty() { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("unsignedClientEnvelope", pbjson::private::base64::encode(&self.unsigned_client_envelope).as_str())?; } if let Some(v) = self.payer_signature.as_ref() { @@ -1792,10 +1800,12 @@ impl serde::Serialize for UnsignedOriginatorEnvelope { let mut struct_ser = serializer.serialize_struct("xmtp.xmtpv4.UnsignedOriginatorEnvelope", len)?; if self.originator_sid != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("originatorSid", ToString::to_string(&self.originator_sid).as_str())?; } if self.originator_ns != 0 { #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] struct_ser.serialize_field("originatorNs", ToString::to_string(&self.originator_ns).as_str())?; } if let Some(v) = self.payer_envelope.as_ref() { diff --git a/xmtp_proto/src/gen/xmtp.xmtpv4.tonic.rs b/xmtp_proto/src/gen/xmtp.xmtpv4.tonic.rs index 9005427c5..3f775e2e1 100644 --- a/xmtp_proto/src/gen/xmtp.xmtpv4.tonic.rs +++ b/xmtp_proto/src/gen/xmtp.xmtpv4.tonic.rs @@ -1,5 +1,6 @@ // @generated /// Generated client implementations. +#[cfg(not(target_arch = "wasm32"))] pub mod replication_api_client { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; @@ -179,6 +180,7 @@ pub mod replication_api_client { } } /// Generated server implementations. +#[cfg(not(target_arch = "wasm32"))] pub mod replication_api_server { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] use tonic::codegen::*; @@ -226,19 +228,17 @@ pub mod replication_api_server { */ #[derive(Debug)] pub struct ReplicationApiServer { - inner: _Inner, + inner: Arc, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, max_decoding_message_size: Option, max_encoding_message_size: Option, } - struct _Inner(Arc); impl ReplicationApiServer { 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(), @@ -301,7 +301,6 @@ pub mod replication_api_server { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { - let inner = self.inner.clone(); match req.uri().path() { "/xmtp.xmtpv4.ReplicationApi/BatchSubscribeEnvelopes" => { #[allow(non_camel_case_types)] @@ -340,7 +339,6 @@ pub mod replication_api_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 = BatchSubscribeEnvelopesSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -387,7 +385,6 @@ pub mod replication_api_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 = QueryEnvelopesSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -434,7 +431,6 @@ pub mod replication_api_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 = PublishEnvelopeSvc(inner); let codec = tonic::codec::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) @@ -456,8 +452,11 @@ pub mod replication_api_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(), ) @@ -478,16 +477,6 @@ pub mod replication_api_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 ReplicationApiServer { const NAME: &'static str = "xmtp.xmtpv4.ReplicationApi"; } From f7ac3c5cb11c74352d45ec5fe6dcd5884915db30 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Thu, 29 Aug 2024 20:11:24 -0700 Subject: [PATCH 6/6] Skip duplicate message processing (#1022) ## Summary Often messages are received on a stream after they have already been synced. This can happen when you have multiple streams open, or when you are processing your own messages. Processing messages is expensive and requires locking the database for a transaction. We're better off skipping these duplicates if we can. This does that by checking if the last synced ID is > the ID of the message. --- xmtp_mls/src/groups/subscriptions.rs | 110 +++++++++++++++------------ 1 file changed, 63 insertions(+), 47 deletions(-) diff --git a/xmtp_mls/src/groups/subscriptions.rs b/xmtp_mls/src/groups/subscriptions.rs index a7f0cb8a8..88cf2faa6 100644 --- a/xmtp_mls/src/groups/subscriptions.rs +++ b/xmtp_mls/src/groups/subscriptions.rs @@ -6,9 +6,11 @@ use futures::Stream; use super::{extract_message_v1, GroupError, MlsGroup}; use crate::storage::group_message::StoredGroupMessage; +use crate::storage::refresh_state::EntityKind; +use crate::storage::StorageError; use crate::subscriptions::{MessagesStreamInfo, StreamHandle}; -use crate::XmtpApi; use crate::{retry::Retry, retry_async, Client}; +use crate::{retry_sync, XmtpApi}; use prost::Message; use xmtp_proto::xmtp::mls::api::v1::GroupMessage; @@ -31,53 +33,55 @@ impl MlsGroup { ); let created_ns = msgv1.created_ns; - let client_pointer = client.clone(); - let process_result = retry_async!( - Retry::default(), - (async { - let client_pointer = client_pointer.clone(); - let client_id = client_id.clone(); - let msgv1 = msgv1.clone(); - self.context - .store - .transaction_async(|provider| async move { - let mut openmls_group = self.load_mls_group(&provider)?; - - // Attempt processing immediately, but fail if the message is not an Application Message - // Returning an error should roll back the DB tx - log::info!( - "current epoch for [{}] in process_stream_entry() is Epoch: [{}]", - client_id, - openmls_group.epoch() - ); - - self.process_message( - client_pointer.as_ref(), - &mut openmls_group, - &provider, - &msgv1, - false, - ) + if !self.has_already_synced(msg_id)? { + let client_pointer = client.clone(); + let process_result = retry_async!( + Retry::default(), + (async { + let client_pointer = client_pointer.clone(); + let client_id = client_id.clone(); + let msgv1 = msgv1.clone(); + self.context + .store + .transaction_async(|provider| async move { + let mut openmls_group = self.load_mls_group(&provider)?; + + // Attempt processing immediately, but fail if the message is not an Application Message + // Returning an error should roll back the DB tx + log::info!( + "current epoch for [{}] in process_stream_entry() is Epoch: [{}]", + client_id, + openmls_group.epoch() + ); + + self.process_message( + client_pointer.as_ref(), + &mut openmls_group, + &provider, + &msgv1, + false, + ) + .await + .map_err(GroupError::ReceiveError) + }) .await - .map_err(GroupError::ReceiveError) - }) - .await - }) - ); - - if let Some(GroupError::ReceiveError(_)) = process_result.as_ref().err() { - // Swallow errors here, since another process may have successfully saved the message - // to the DB - match self.sync_with_conn(&client.mls_provider()?, &client).await { - Ok(_) => { - log::debug!("Sync triggered by streamed message successful") - } - Err(err) => { - log::warn!("Sync triggered by streamed message failed: {}", err); - } - }; - } else if process_result.is_err() { - log::error!("Process stream entry {:?}", process_result.err()); + }) + ); + + if let Some(GroupError::ReceiveError(_)) = process_result.as_ref().err() { + // Swallow errors here, since another process may have successfully saved the message + // to the DB + match self.sync_with_conn(&client.mls_provider()?, &client).await { + Ok(_) => { + log::debug!("Sync triggered by streamed message successful") + } + Err(err) => { + log::warn!("Sync triggered by streamed message failed: {}", err); + } + }; + } else if process_result.is_err() { + log::error!("Process stream entry {:?}", process_result.err()); + } } // Load the message from the DB to handle cases where it may have been already processed in @@ -91,6 +95,18 @@ impl MlsGroup { Ok(new_message) } + // Checks if a message has already been processed through a sync + fn has_already_synced(&self, id: u64) -> Result { + let check_for_last_cursor = || -> Result { + let conn = self.context.store.conn()?; + conn.get_last_cursor_for_id(&self.group_id, EntityKind::Group) + }; + + let last_id = retry_sync!(Retry::default(), check_for_last_cursor)?; + + Ok(last_id >= id as i64) + } + pub async fn process_streamed_group_message( &self, envelope_bytes: Vec,