Skip to content

feat(whitelist): store entries as keyed persistent flags (#1220) - #1364

Open
Nuruddeen61 wants to merge 2 commits into
CalloraOrg:mainfrom
Nuruddeen61:main
Open

Nuruddeen61 wants to merge 2 commits into
CalloraOrg:mainfrom
Nuruddeen61:main

Conversation

@Nuruddeen61

@Nuruddeen61 Nuruddeen61 commented Oct 2, 2026 •

Copy link
Copy Markdown

Closes #1220

Rebuilt on top of current main to address review feedback on #1259.

Changes

  • Whitelisted(epoch, address) -> slot and WhitelistSlot(epoch, slot) -> address in persistent storage, so is_whitelisted is an O(1) keyed lookup
  • Instance storage keeps scalars only: WhitelistEpoch, WhitelistCount, WhitelistMigrated, WhitelistMigrationCursor
  • add_address / remove_address: O(1) insert and swap-remove with TTL bumps
  • clear_all: O(1) epoch bump
  • migrate_legacy: batched (MAX_MIGRATION_BATCH = 100), idempotent and cursor-based; mutations return MigrationPending until it finishes
  • get_whitelist_page and whitelist_count added for large lists

Review feedback addressed

  • All 21 existing unit tests are kept (the error-code test is extended with codes 53 and 54); 7 new tests added (swap-remove, epoch clear, paging, legacy fallback reads, batched and idempotent migration, mutations blocked during migration, non-admin migration).
  • New error MigrationPending = 54 (53 is already AdminTransferCancelled)
  • Events, cancel_admin_transfer and cool-off behavior are preserved
  • Rebased on current main, no conflicts

Also fixes a compile error on main: cancel_admin_transfer referenced an undefined
new_admin (the admin_accepted event block belongs in accept_admin); moved it back.

@Nuruddeen61

Copy link
Copy Markdown
Author

CI is currently red on main independent of this PR:

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.

Store whitelist entries as keyed persistent flags

1 participant