From 2b54df593a18ac4803d2a900bb8ff880735c09d2 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Fri, 16 Aug 2024 16:53:39 -0700 Subject: [PATCH 1/3] Repro missing epochs --- openmls/src/group/tests/test_past_secrets.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openmls/src/group/tests/test_past_secrets.rs b/openmls/src/group/tests/test_past_secrets.rs index f065919d8..aa37504fc 100644 --- a/openmls/src/group/tests/test_past_secrets.rs +++ b/openmls/src/group/tests/test_past_secrets.rs @@ -5,6 +5,7 @@ use crate::{ framing::{MessageDecryptionError, MlsMessageIn, ProcessedMessageContent}, group::*, }; +use openmls_traits::OpenMlsProvider; #[openmls_test::openmls_test] fn test_past_secrets_in_group( @@ -135,9 +136,11 @@ fn test_past_secrets_in_group( ),) )); } - // The last messages should not fail for application_message in application_messages.iter().skip(max_epochs / 2) { + let mut bob_group = MlsGroup::load(provider.storage(), bob_group.group_id()) + .expect("reload group") + .unwrap(); let bob_processed_message = bob_group .process_message(provider, application_message.clone()) .expect("An unexpected error occurred."); From 6ea8d176cb41529601559658a56b6dc2e307daf8 Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Fri, 16 Aug 2024 17:01:29 -0700 Subject: [PATCH 2/3] Only reload once --- openmls/src/group/tests/test_past_secrets.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/openmls/src/group/tests/test_past_secrets.rs b/openmls/src/group/tests/test_past_secrets.rs index aa37504fc..ecfbf15de 100644 --- a/openmls/src/group/tests/test_past_secrets.rs +++ b/openmls/src/group/tests/test_past_secrets.rs @@ -123,7 +123,6 @@ fn test_past_secrets_in_group( } // === Test application messages from older epochs === - // The first messages should fail for application_message in application_messages.iter().take(max_epochs / 2) { let err = bob_group @@ -136,11 +135,11 @@ fn test_past_secrets_in_group( ),) )); } + let mut bob_group = MlsGroup::load(provider.storage(), bob_group.group_id()) + .expect("reload group") + .unwrap(); // The last messages should not fail for application_message in application_messages.iter().skip(max_epochs / 2) { - let mut bob_group = MlsGroup::load(provider.storage(), bob_group.group_id()) - .expect("reload group") - .unwrap(); let bob_processed_message = bob_group .process_message(provider, application_message.clone()) .expect("An unexpected error occurred."); From 53fdb50ad17552da0af91f7f6a03e19d8025fc6b Mon Sep 17 00:00:00 2001 From: Nicholas Molnar <65710+neekolas@users.noreply.github.com> Date: Fri, 16 Aug 2024 17:05:26 -0700 Subject: [PATCH 3/3] Write message secrets --- openmls/src/group/core_group/process.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/openmls/src/group/core_group/process.rs b/openmls/src/group/core_group/process.rs index e203643af..377695248 100644 --- a/openmls/src/group/core_group/process.rs +++ b/openmls/src/group/core_group/process.rs @@ -305,6 +305,10 @@ impl CoreGroup { if let Some(message_secrets) = self.merge_commit(provider, staged_commit)? { self.message_secrets_store .add(past_epoch, message_secrets, leaves); + provider + .storage() + .write_message_secrets(self.group_id(), &self.message_secrets_store) + .map_err(|err| MergeCommitError::StorageError(err))?; } // Empty the proposal store proposal_store.empty();