Skip to content

Commit

Permalink
Set MAX_PAST_EPOCHS consistently
Browse files Browse the repository at this point in the history
  • Loading branch information
neekolas committed Aug 19, 2024
1 parent 52101de commit fa09077
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions xmtp_mls/src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ pub const UPDATE_INSTALLATIONS_INTERVAL_NS: i64 = NANOSECONDS_IN_HOUR / 2; // 30

pub const MAX_GROUP_SIZE: u16 = 400;

pub const MAX_PAST_EPOCHS: usize = 3;

/// the max amount of data that can be sent in one gRPC call
/// we leave 5 * 1024 * 1024 as extra buffer room
pub const GRPC_DATA_LIMIT: usize = 45 * 1024 * 1024;
Expand Down
6 changes: 3 additions & 3 deletions xmtp_mls/src/groups/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ use crate::{
client::{deserialize_welcome, ClientError, MessageProcessingError, XmtpMlsLocalContext},
configuration::{
CIPHERSUITE, GROUP_MEMBERSHIP_EXTENSION_ID, GROUP_PERMISSIONS_EXTENSION_ID, MAX_GROUP_SIZE,
MUTABLE_METADATA_EXTENSION_ID,
MAX_PAST_EPOCHS, MUTABLE_METADATA_EXTENSION_ID,
},
hpke::{decrypt_welcome, HpkeError},
identity::{parse_credential, Identity, IdentityError},
Expand Down Expand Up @@ -1164,7 +1164,7 @@ fn build_group_config(
.capabilities(capabilities)
.ciphersuite(CIPHERSUITE)
.wire_format_policy(WireFormatPolicy::default())
.max_past_epochs(3) // Trying with 3 max past epochs for now
.max_past_epochs(MAX_PAST_EPOCHS) // Trying with 3 max past epochs for now
.use_ratchet_tree_extension(true)
.build())
}
Expand Down Expand Up @@ -1211,7 +1211,7 @@ async fn validate_initial_group_membership<ApiClient: XmtpApi>(
fn build_group_join_config() -> MlsGroupJoinConfig {
MlsGroupJoinConfig::builder()
.wire_format_policy(WireFormatPolicy::default())
.max_past_epochs(3) // Trying with 3 max past epochs for now
.max_past_epochs(MAX_PAST_EPOCHS) // Trying with 3 max past epochs for now
.use_ratchet_tree_extension(true)
.build()
}
Expand Down
4 changes: 2 additions & 2 deletions xmtp_mls/src/groups/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::{
client::MessageProcessingError,
codecs::{group_updated::GroupUpdatedCodec, ContentCodec},
configuration::{
DELIMITER, GRPC_DATA_LIMIT, MAX_GROUP_SIZE, MAX_INTENT_PUBLISH_ATTEMPTS,
DELIMITER, GRPC_DATA_LIMIT, MAX_GROUP_SIZE, MAX_INTENT_PUBLISH_ATTEMPTS, MAX_PAST_EPOCHS,
UPDATE_INSTALLATIONS_INTERVAL_NS,
},
groups::{
Expand Down Expand Up @@ -345,7 +345,7 @@ impl MlsGroup {
intent.id,
group_epoch,
message_epoch,
1, // max_past_epochs, TODO: expose from OpenMLS MlsGroup
MAX_PAST_EPOCHS,
) {
conn.set_group_intent_to_publish(intent.id)?;
return Ok(());
Expand Down

0 comments on commit fa09077

Please sign in to comment.