Skip to main content

merge_app_data_into_mutable_metadata

Function merge_app_data_into_mutable_metadata 

Source
pub fn merge_app_data_into_mutable_metadata(
    base: &mut GroupMutableMetadata,
    mls_group: &MlsGroup,
) -> Result<(), ComponentSourceError>
Expand description

Overlay AppData-dict component values onto a base GroupMutableMetadata.

Wire formats (must match what the sender emits via apply_app_data_update_payload):

  • Bytes components: raw UTF-8 string bytes.
  • ADMIN_LIST / SUPER_ADMIN_LIST: TLS-serialized TlsSet<InboxId>, each id hex-encoded back to string form.

§Independence from COMPONENT_REGISTRY parseability

This function reads metadata field entries directly from the dict and never loads or validates the COMPONENT_REGISTRY payload — it does not use the COMPONENT_REGISTRY payload as a gate. So a malformed COMPONENT_REGISTRY blob does NOT cause metadata reads to drop authoritative data: as long as the individual metadata field bytes (GROUP_NAME, ADMIN_LIST, …) decode correctly, they round-trip into the returned GMM. Registry corruption is surfaced loudly on the write paths instead — the sender gate in mls_sync.rs and the commit validator in validated_commit.rs both call xmtp_mls’s load_component_registry and propagate decode errors — so a corrupt registry blocks state changes without making readable data unreachable. See merge_with_malformed_registry_returns_valid_field for the test that pins this invariant.