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
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! 🚀 |
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.
…solve PR CalloraOrg#1447 conflicts Resolve doc-comment style conflict in contracts/yield/src/lib.rs (/// outer docs vs //! inner crate docs) and integrate latest base main so the PR is mergeable.
- Apply cargo fmt --all across workspace to satisfy format check - Fix corrupted syntax from Windows merge: backtick/bracket confusion (#[cfg(test)] -> #[cfg(test)], ##[test] -> #[test]), single-colon paths (soroban_sdk:x -> soroban_sdk::x), missing bang (#no_std -> #![no_std]), pubmod/use super:* -> pub mod/use super::*, stray > in BytesN32 type - This unblocks test and WASM build steps on CI (Ubuntu)
|
Merge conflict is now fixed, review and merge. |
|
Held: the whitelist tests don't compile ( |
…ip (keep PR changes on conflicts)
merge conflit is now fixed. |
merge conflit is fixed |
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