diff --git a/bindings_ffi/Cargo.lock b/bindings_ffi/Cargo.lock index 1f37401ed..9d9afb5aa 100644 --- a/bindings_ffi/Cargo.lock +++ b/bindings_ffi/Cargo.lock @@ -977,9 +977,9 @@ dependencies = [ [[package]] name = "diesel" -version = "2.2.0" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35b696af9ff4c0d2a507db2c5faafa8aa0205e297e5f11e203a24226d5355e7a" +checksum = "bf97ee7261bb708fa3402fa9c17a54b70e90e3cb98afb3dc8999d5512cb03f94" dependencies = [ "diesel_derives", "libsqlite3-sys", @@ -2550,9 +2550,9 @@ dependencies = [ [[package]] name = "libsqlite3-sys" -version = "0.28.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c10584274047cb335c23d3e61bcef8e323adae7c5c8c760540f73610177fc3f" +checksum = "d4588d65215825ee71ebff9e1c9982067833b1355d7546845ffdb3165cbd7456" dependencies = [ "cc", "openssl-sys", diff --git a/bindings_ffi/src/mls.rs b/bindings_ffi/src/mls.rs index eb1df7f4c..39fea18f6 100644 --- a/bindings_ffi/src/mls.rs +++ b/bindings_ffi/src/mls.rs @@ -2228,6 +2228,88 @@ mod tests { ); } + #[tokio::test(flavor = "multi_thread", worker_threads = 5)] + async fn test_can_send_messages_when_epochs_behind() { + let alix = new_test_client().await; + let bo = new_test_client().await; + let caro = new_test_client().await; + + let alix_group = alix + .conversations() + .create_group( + vec![caro.account_address.clone()], + FfiCreateGroupOptions::default(), + ) + .await + .unwrap(); + + caro.conversations().sync().await.unwrap(); + + let caro_group = caro.group(alix_group.id()).unwrap(); + + alix_group + .send("alix message 1".as_bytes().to_vec()) + .await + .unwrap(); + caro_group + .send("caro message 1".as_bytes().to_vec()) + .await + .unwrap(); + alix_group + .add_members(vec![bo.account_address.clone()]) + .await + .unwrap(); + alix_group + .send("alix message 2".as_bytes().to_vec()) + .await + .unwrap(); + caro_group + .send("caro message 2".as_bytes().to_vec()) + .await + .unwrap(); + + bo.conversations().sync().await.unwrap(); + let bo_group = bo.group(alix_group.id()).unwrap(); + bo_group + .send("bo message 1".as_bytes().to_vec()) + .await + .unwrap(); + + bo_group.sync().await.unwrap(); + alix_group.sync().await.unwrap(); + caro_group.sync().await.unwrap(); + + let alix_messages = alix_group + .find_messages(FfiListMessagesOptions::default()) + .unwrap(); + let caro_messages = caro_group + .find_messages(FfiListMessagesOptions::default()) + .unwrap(); + let bo_messages = bo_group + .find_messages(FfiListMessagesOptions::default()) + .unwrap(); + + let caro_message_2_found_bo = bo_messages + .iter() + .any(|message| message.content == "caro message 2".as_bytes()); + assert!( + caro_message_2_found_bo, + "\"caro message 2\" not found in bo_messages" + ); + + let caro_message_2_found = alix_messages + .iter() + .any(|message| message.content == "caro message 2".as_bytes()); + assert!( + caro_message_2_found, + "\"caro message 2\" not found in alix_messages" + ); + + assert_eq!(alix_messages.len(), 7); + assert_eq!(caro_messages.len(), 6); + assert_eq!(bo_messages.len(), 3); + } + #[tokio::test(flavor = "multi_thread", worker_threads = 5)] async fn test_can_add_members_when_out_of_sync() { let alix = new_test_client().await; diff --git a/bindings_node/Cargo.lock b/bindings_node/Cargo.lock index a9c67462e..da46c7974 100644 --- a/bindings_node/Cargo.lock +++ b/bindings_node/Cargo.lock @@ -846,9 +846,9 @@ dependencies = [ [[package]] name = "diesel" -version = "2.2.0" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35b696af9ff4c0d2a507db2c5faafa8aa0205e297e5f11e203a24226d5355e7a" +checksum = "bf97ee7261bb708fa3402fa9c17a54b70e90e3cb98afb3dc8999d5512cb03f94" dependencies = [ "diesel_derives", "libsqlite3-sys", @@ -2373,9 +2373,9 @@ dependencies = [ [[package]] name = "libsqlite3-sys" -version = "0.28.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c10584274047cb335c23d3e61bcef8e323adae7c5c8c760540f73610177fc3f" +checksum = "d4588d65215825ee71ebff9e1c9982067833b1355d7546845ffdb3165cbd7456" dependencies = [ "cc", "openssl-sys", @@ -2885,9 +2885,9 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.12.2" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" dependencies = [ "lock_api", "parking_lot_core", @@ -5443,6 +5443,7 @@ dependencies = [ "openmls_basic_credential", "openmls_rust_crypto", "openmls_traits", + "parking_lot", "prost 0.12.6", "rand", "reqwest 0.12.4", diff --git a/xmtp_mls/src/groups/sync.rs b/xmtp_mls/src/groups/sync.rs index 27c1c339e..42fa69604 100644 --- a/xmtp_mls/src/groups/sync.rs +++ b/xmtp_mls/src/groups/sync.rs @@ -342,7 +342,7 @@ impl MlsGroup { intent.id, group_epoch, message_epoch, - 3, // max_past_epochs, TODO: expose from OpenMLS MlsGroup + 1, // max_past_epochs, TODO: expose from OpenMLS MlsGroup ) { conn.set_group_intent_to_publish(intent.id)?; return Ok(());