Skip to content

smartcontract: move multicast group allowlists from AccessPass vecs to PDAs#2856

Open
martinsander00 wants to merge 2 commits intomainfrom
ms/529
Open

smartcontract: move multicast group allowlists from AccessPass vecs to PDAs#2856
martinsander00 wants to merge 2 commits intomainfrom
ms/529

Conversation

@martinsander00
Copy link
Contributor

Resolves: https://github.com/malbeclabs/infra/issues/529

Summary

  • Replace mgroup_pub_allowlist and mgroup_sub_allowlist vecs inside AccessPass with dedicated MGroupAllowlistEntry PDAs, eliminating unbounded account growth and reallocation costs
  • Add self-migration path: subscribe and create_subscribe processors automatically migrate existing vec entries to PDAs on use, removing them from the vec after PDA creation
  • Allowlist add now creates a separate PDA account; allowlist remove closes the PDA and reclaims rent
  • New MGroupAllowlistEntry account type (id=13) with SEED_MGROUP_ALLOWLIST seed, keyed by access pass, multicast group, and allowlist type (publisher/subscriber)

Testing Verification

  • Unit tests for MGroupAllowlistEntry serialization and validation
  • Updated integration tests for allowlist add/remove with new PDA account
  • Expanded multicast subscribe tests covering PDA-based allowlist checks and vec-to-PDA migration

@martinsander00 martinsander00 force-pushed the ms/529 branch 3 times, most recently from 02c559e to 71d5523 Compare February 7, 2026 03:25

/// Check if an access pass is allowed for a multicast group (PDA-first with Vec fallback + self-migration).
/// Returns true if the Vec was modified and the access pass needs to be written back.
pub(crate) fn check_and_migrate_allowlist<'a>(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we could move this somewhere else. Open to suggestions

…o PDAs

Replace mgroup_pub_allowlist and mgroup_sub_allowlist vecs inside
AccessPass with dedicated MGroupAllowlistEntry PDAs. This eliminates
unbounded account growth and reallocation costs.

Adds self-migration path in subscribe and create_subscribe processors
that automatically migrates existing vec entries to PDAs on use.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant