Repository navigation
serde serialization helpers for non-self-describing storage representations - #2034
Merged
Merged
Conversation
Contributor
Author
Contributor
franziskuskiefer
left a comment
Member
There was a problem hiding this comment.
I think this is the right approach. Let's clean it up and make it mergeable unless someone has a better idea.
wysiwys
marked this pull request as ready for review
May 28, 2026 13:18
franziskuskiefer
left a comment
Member
There was a problem hiding this comment.
Just a few more nits and there are a few open comments.
I think the most important one is on documentation. This is a breaking change for storage when upgrading from 0.8.1. Is there a way to help consumers with that? Is there something to test on that?
Co-authored-by: Franziskus Kiefer <[email protected]>
franziskuskiefer
previously approved these changes
Jun 5, 2026
franziskuskiefer
left a comment
Member
There was a problem hiding this comment.
Let's first get #2047 merged in here. Then this is good to go.
…th `openmls` v0.8.1 (#2047)
wysiwys
enabled auto-merge (squash)
June 9, 2026 08:56
This was referenced Jun 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request proposes adding serialization helper macros for use with
serdenon-self-describing formats, which pin the storage tag index used for each enum variant. It uses these macros to pin storage tags forProposal/ProposalType,Extension/ExtensionType, andCredentialType, and also adds anopenmls_compat_testscrate which includes tests for storage tag stability acrossopenmlsversions. This PR was initially opened as a starting point for discussion.As a basis for discussion, this draft pull request proposes a way to address some issues with non-self-describing
serdeserialization that were identified in #2021. Since non-self-describingserdeformats serialize enum variants using a tag corresponding to the variant's position in the list of variants, when new versions ofopenmlsadded new variants to some serializable enums (e.g.CredentialType::Grease(_)) or removed some from others (e.g.Proposal::AppAck), the position of some existing variants was affected, leading to deserialization failures.To prevent these kinds of deserialization issues in the future, this draft PR proposes pinning a fixed storage tag for each enum variant, so that it is not affected by future removals or additions of variants. The proposed solution is implemented using serialization helper macros that can be used to implement
serde::Serializeandserde::Deserializetraits on these enums. These macros allow specifying astorage_tagattribute on each variant, to pin it to a specific index:Using this approach, new variants can be added to these enums in a way that ensures that their
serdenon-self-describing serialization does not conflict with existing serializations, independent of feature flag annotations on the enum variants.In the
openmlslibrary, in this PR, theseopenmls_serialization_helpersmacros are used to implement theserde::Serializeandserde::Deserializetraits for each ofProposal/ProposalType,Extension/ExtensionType, andCredentialType. Theserdetrait implementations using the macros corresponds to the individual implementations of theseserdetraits for these enums proposed in #2021.This PR also reorders some enum variants so that enum variants are in ascending order by their
storage_tagattribute for readability, but this list position no longer affects the index used in non-self-describingserdeserialization.