Repository navigation
Conversation
Move whitelist membership from a single instance-storage Vec to per-address persistent entries for O(1) is_whitelisted, with paginated enumeration via get_whitelist_page. Adds bounded clear_page, admin-only migrate_list to drain the legacy WhitelistList Vec in chunks, and TTL extension on add/read. Drops the duplicate legacy admin_nominated publish. Deprecates get_whitelist in favor of get_whitelist_page. Closes CalloraOrg#1421
Tekh134
force-pushed
the
perf/whitelist-persistent-membership
branch
from
October 20, 2026 03:58
8e26964 to
50a6f72
Compare
|
@Tekh134 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
added 13 commits
October 20, 2026 05:57
Revert get_whitelist to original signature (no caller param, returns Vec<Address>, reads from WhitelistList) to maintain backward compatibility with existing tests. Mark as deprecated and cap at MAX_PAGE. get_whitelist_page remains the new paginated API requiring auth and returning Result.
…n and clear Fix clear_page_inner to keep WhitelistList in sync with WhitelistIndex on partial clears so deprecated get_whitelist returns consistent data. Fix migrate_list to rebuild WhitelistIndex from remaining entries after partial migration, and to clear WhitelistIndex when migration fully drains the legacy Vec.
Fix cargo fmt failure caused by inner attribute #![no_std] appearing after outer doc comments. Also fix #[config(test)] typo -> #[cfg(test)] which would break cargo test.
Fix compile error: enumerate() index is usize but to_clear is u32. Cast i to u32 before comparison.
Fix compile error: get_ttl is on Storage, not PersistentStorage. Add Eq to StorageKey derive for use as storage key map key.
Only sync WhitelistList from WhitelistIndex when entries were actually cleared (to_clear > 0), to avoid wiping legacy-only entries.
Fix migrate_list to rebuild WhitelistIndex from existing index + remaining entries + newly migrated addresses, so get_whitelist_page returns all members after migration. Don't reset MemberCount to 0 on migration completion.
Always set WhitelistList to remaining after clear_page_inner so clear_all clears WhitelistList-only entries too (e.g. seed_member in tests).
Fix all compilation errors in whitelist contract: - Address comparison: a != &address -> a != address - usize/u32 comparison in clear_page_inner - &remaining.len() as u32 -> &(remaining.len() as u32) - Vec::new(env) -> Vec::new(&env) where env is owned - MAX_PAGE as usize -> MAX_PAGE for u32 comparison
Fix checkpoint/src/lib.rs compilation errors blocking cargo test --workspace: - validate_before_upgrade takes 6 args, removed extra probe keys argument - finalize_migration takes 4 args, removed extra probe keys argument - Added IntoVal import for StorageKey::Admin.into_val(env) - Replaced Address::from_contract_id() with env.current_contract_address() (from_contract_id is private; current_contract_address() returns Address) - Fixed Val::VOID -> Val::VOID.into() for try_into_val unwrap_or_else
…e_keys try_into_val takes &self, so current_contract_address() result needs &. This was the remaining compilation error blocking cargo test --workspace.
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.
Closes #1421
Summary
Moves the whitelist from a single instance-storage Vec to per-address persistent entries, with paginated enumeration.
Changes
New storage
Paginated enumeration
clear_all (bounded)
Migration
Events
Test plan coverage (all rows)
Cost budget (is_whitelisted)
Previously: O(n) Vec scan over instance storage, growing linearly.
Migration docs