Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
codabrink committed Jan 29, 2025
1 parent c94ad52 commit da9f464
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
8 changes: 4 additions & 4 deletions xmtp_id/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ pub type InboxId = String;
pub type WalletAddress = String;

pub trait AsIdRef: Send + Sync {
fn as_ref<'a>(&'a self) -> InboxIdRef<'a>;
fn as_ref(&'_ self) -> InboxIdRef<'_>;
}

impl AsIdRef for InboxId {
fn as_ref<'a>(&'a self) -> InboxIdRef<'a> {
&*self
fn as_ref(&self) -> InboxIdRef<'_> {
self
}
}
impl AsIdRef for InboxIdRef<'_> {
fn as_ref<'a>(&'a self) -> InboxIdRef<'a> {
fn as_ref(&self) -> InboxIdRef<'_> {
self
}
}
Expand Down
12 changes: 4 additions & 8 deletions xmtp_mls/src/groups/mls_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -583,8 +583,9 @@ where
mls_group,
)
.await?;
// We don't care about the validated commit because we need to recreate it below anyway.
// This is to fetch the missing identity updates.
// We don't care about the validated commit because we need to
// recreate it below after re-processing the message anyway.
// This is to fetch the missing identity updates so the eager revalidation below doesn't fail.
let _ = ValidatedCommit::from_staged_commit_with_identity_update_attempt(
&self.client,
provider.conn_ref(),
Expand All @@ -601,21 +602,16 @@ where

provider.transaction(|provider| {
let processed_message = mls_group.process_message(provider, message)?;

let mut validated_commit = None;

if let ProcessedMessageContent::StagedCommitMessage(staged_commit) =
processed_message.content()
{
let Some(expected_diff) = expected_diff else {
unreachable!();
};

validated_commit = Some(ValidatedCommit::from_staged_commit(
provider.conn_ref(),
staged_commit,
mls_group,
&expected_diff,
&expected_diff.expect("Should be cached from above."),
)?);
}

Expand Down
4 changes: 2 additions & 2 deletions xmtp_mls/src/groups/scoped_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ pub trait ScopedGroupClient: Sized {
to_sequence_id: Option<i64>,
) -> Result<AssociationState, ClientError>;

async fn batch_get_association_state<'a>(
async fn batch_get_association_state(
&self,
conn: &DbConnection,
identifiers: &[(InboxIdRef<'a>, Option<i64>)],
identifiers: &[(impl AsIdRef, Option<i64>)],
) -> Result<Vec<AssociationState>, ClientError>;

async fn query_group_messages(
Expand Down

0 comments on commit da9f464

Please sign in to comment.