Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mutable Metadata group name Part 1 #643

Merged
merged 6 commits into from
Apr 12, 2024

Conversation

cameronvoell
Copy link
Contributor

@cameronvoell cameronvoell commented Apr 10, 2024

Part 1 for #548

We would like to have a metadata extension type that can be modified after group creation. This is possible using the Unknown Group Context Extension type, which accepts a byte array as the only field. See #548 for more info.

Related PR's:

Before merging this to main:

  • Update openmls reference in Cargo.toml to commit on xmtp/openmls main branch
  • Update dev/gen_protos.sh to point to xmtp-proto repo main branch

@cameronvoell cameronvoell force-pushed the cv/mutable-metadata-group-name-part-1 branch from a4e45ca to 052dc43 Compare April 10, 2024 05:33
@cameronvoell cameronvoell marked this pull request as ready for review April 10, 2024 06:44
@cameronvoell cameronvoell requested a review from a team as a code owner April 10, 2024 06:44
Copy link
Contributor

@insipx insipx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall!, just a nit wondering why we are separating out the TryFrom/TryInto between impl on a struct and in the trait implementation?

}
}

pub(crate) fn from_proto(
Copy link
Contributor

@insipx insipx Apr 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have both from/to proto and re-use in the trait

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I definitely copied from xmtp_mls/src/groups/group_metadata.rs, but I agree with your thinking (if I'm understanding correctly).

Updated here => d91fe5b Let me know if you meant something else.

Self { group_name }
}

pub(crate) fn to_bytes(&self) -> Vec<u8> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we just unify all the conversion methods in the TryFrom to avoid confusion; what's the benefit of having the method on UpdateMetadataIntentData?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated here. I think this is what you were suggesting, but let me know if you meant something else.

@@ -231,19 +231,22 @@ pub struct PolicySet {
pub remove_member_policy: MembershipPolicies,
pub add_installation_policy: MembershipPolicies,
pub remove_installation_policy: MembershipPolicies,
pub update_group_name_policy: MembershipPolicies,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kinda think we should have a new type of policy for metadata. Some of the MembershipPolicies aren't applicable here (for example, AllowSameMember) and it makes easier to be misused having that as an option.

What if we had a different type, like MetadataPolicy that can be more tailored towards updating metadata.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, ill make that update 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@neekolas updating to include a new MetadataPolicy type actually adds a lot of cascading updates, since it touches all the validation logic. I was going to tackle validation logic in part 3, so how do we feel about leaving MetadataPolicy to the part 3 PR?

@cameronvoell cameronvoell force-pushed the cv/mutable-metadata-group-name-part-1 branch from eb1143e to a236ed4 Compare April 12, 2024 22:10
@cameronvoell
Copy link
Contributor Author

cameronvoell commented Apr 12, 2024

Looks good overall!, just a nit wondering why we are separating out the TryFrom/TryInto between impl on a struct and in the trait implementation?

Thanks for the feedback @insipx . I liked you suggestion to put all conversion logic in TryFrom functions and avoiding having redundant functions. I created an issue here => #657 for cleaning up other instances of this pattern, because I think there are quite a few, but it is probably best to keep outside the scope of this PR. Let me know if you think I misunderstood your suggestion 🙇

@cameronvoell cameronvoell merged commit 1331100 into main Apr 12, 2024
6 checks passed
@cameronvoell cameronvoell deleted the cv/mutable-metadata-group-name-part-1 branch April 12, 2024 23:28
@tuddman tuddman mentioned this pull request Apr 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants