Skip to main content

synthesize_registry_from_policy_set

Function synthesize_registry_from_policy_set 

Source
pub fn synthesize_registry_from_policy_set(
    policy_set: &PolicySet,
) -> Result<ComponentRegistry, MigrationError>
Expand description

Produce a populated ComponentRegistry from the legacy PolicySetProto. Deterministic: every honest peer synthesizes bit-identical output from the same input.

Mapping summary:

  • Mutable scalar components pull insert/update from update_metadata_policy[field_name]; a missing key defaults to admin-only (super-admin for the 0x800A protocol-version floor), mirroring the legacy enforcer. Delete is hardcoded super-admin-only. Per-field ComponentType comes from [metadata_field_registry_mapping] — disappearing-message timestamps are bytes (BE-u64), the rest are utf-8 strings.
  • ADMIN_LIST is constrained: insert/update from add_admin_policy, delete from remove_admin_policy. All must be admin-or- super-admin (synthesis rejects otherwise).
  • SUPER_ADMIN_LIST and COMPONENT_REGISTRY are hardcoded super-admin-only and not written to the registry.
  • GROUP_MEMBERSHIP mirrors add_member_policy/remove_member_policy for insert/delete; update is Allow (anyone can advance installations).
  • Immutable components: super-admin insert, deny update + delete.