Skip to content

Commit

Permalink
Add test for incorrect max_past_epochs value
Browse files Browse the repository at this point in the history
  • Loading branch information
neekolas committed Oct 9, 2024
1 parent 11970a8 commit 10c2c4f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion openmls/src/group/mls_group/past_secrets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct EpochTree {
#[cfg_attr(feature = "crypto-debug", derive(Debug))]
pub(crate) struct MessageSecretsStore {
// Maximum size of the `past_epoch_trees` list.
max_epochs: usize,
pub(crate) max_epochs: usize,
// Past message secrets.
past_epoch_trees: VecDeque<EpochTree>,
// The message secrets of the current epoch.
Expand Down
28 changes: 28 additions & 0 deletions openmls/src/group/mls_group/tests_and_kats/tests/mls_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1156,6 +1156,34 @@ fn remove_prosposal_by_ref(
}
}

#[openmls_test]
fn max_past_epochs_join_config(
ciphersuite: Ciphersuite,
provider: &impl crate::storage::OpenMlsProvider,
) {
let max_past_epochs = 10;

let create_config = MlsGroupCreateConfig::builder()
.max_past_epochs(max_past_epochs)
.build();

let (alice_credential_with_key, _alice_kpb, alice_signer, _alice_pk) =
setup_client("Alice", ciphersuite, provider);

let alice_group = MlsGroup::new(
provider,
&alice_signer,
&create_config,
alice_credential_with_key,
)
.expect("failed to create group");

assert_eq!(
alice_group.message_secrets_store.max_epochs,
max_past_epochs
);
}

// Test that the builder pattern accurately configures the new group.
#[openmls_test]
fn builder_pattern() {
Expand Down

0 comments on commit 10c2c4f

Please sign in to comment.