Repository navigation
test: adversarial coverage for get_whitelist (#1107) - #1225
Closed
Manager-dev1515 wants to merge 1 commit into
Closed
Manager-dev1515 wants to merge 1 commit into
Manager-dev1515 wants to merge 1 commit into
Conversation
|
@Manager-dev1515 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! 🚀 |
Adds src/test_get_whitelist.rs — a focused, standalone test module with 21 deterministic tests covering every meaningful behaviour of the get_whitelist(env, issuer, namespace, token) -> Vec<Address> query. src/test_get_whitelist.rs (new file) 21 tests across 14 categories — all passing in CI (Ubuntu, cargo test). src/lib.rs Added '#[cfg(test)] mod test_get_whitelist;' to the test-module registry. | Category | Test name | |----------------------------------------|----------------------------------------------------------| | Empty / uninitialized state | get_whitelist_returns_empty_vec_for_unregistered_offering| | Empty after register, no adds | get_whitelist_empty_after_register_no_adds | | Single entry | get_whitelist_single_entry | | Multiple entries | get_whitelist_returns_all_members | | Removal reflected | get_whitelist_reflects_removal | | Full add/remove round-trip | get_whitelist_empty_after_all_removed | | Idempotent add (no duplicates) | get_whitelist_no_duplicate_after_double_add | | Namespace isolation | get_whitelist_is_isolated_by_namespace | | Token isolation | get_whitelist_is_isolated_by_token | | Issuer isolation | get_whitelist_is_isolated_by_issuer | | Wrong-issuer boundary | get_whitelist_wrong_issuer_returns_empty | | Wrong-namespace boundary | get_whitelist_wrong_namespace_returns_empty | | Wrong-token boundary | get_whitelist_wrong_token_returns_empty | | Read does not mutate storage | get_whitelist_read_does_not_mutate_storage | | Cross-offering non-interference | get_whitelist_cross_offering_no_interference | | Blacklist has no effect on list | get_whitelist_unaffected_by_blacklist | | Frozen contract still readable | get_whitelist_readable_when_contract_frozen | | Paused contract still readable | get_whitelist_readable_when_contract_paused | | Frozen offering still readable | get_whitelist_readable_when_offering_frozen | | Admin-added entries visible | get_whitelist_entries_added_by_admin_are_visible | | Count consistent with is_whitelisted | get_whitelist_count_consistent_with_is_whitelisted | - Empty/unregistered: confirms graceful degradation to empty Vec (no panic). - Namespace/token/issuer isolation: the storage key is a composite (issuer, namespace, token) triple; each axis must be tested independently to prove there is no key-collision that would let one offering read another's whitelist. - Wrong-key boundary probes: adversarial callers supplying a valid-looking but incorrect key component must always receive an empty Vec, never a panic or a foreign list. - Read immutability: two sequential reads must produce identical output, confirming get_whitelist has no write side-effect. - Frozen/paused/offering-frozen: read-only queries must remain available even when state-mutation is blocked; this verifies the absence of a spurious require_not_frozen / require_not_paused guard on the read path. - Blacklist non-interference: the blacklist and whitelist are stored in separate maps; adding to one must not corrupt the other. - Admin writes visible: confirms admin-initiated whitelist_add commits to the same storage key that get_whitelist reads, closing a potential split-brain between caller roles. - is_whitelisted consistency: every address in get_whitelist must return true from is_whitelisted, and absent addresses must return false. get_whitelist signature and behaviour are unchanged. No production code was modified; the only lib.rs change is the #[cfg(test)] module declaration. Closes RevoraOrg#1107
Manager-dev1515
force-pushed
the
test/adversarial-get-whitelist-1107
branch
from
October 15, 2026 21:46
d580124 to
6f12c0f
Compare
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.
Adds src/test_get_whitelist.rs — a focused, standalone test module with 21 deterministic tests covering every meaningful behaviour of the get_whitelist(env, issuer, namespace, token) -> Vec
query.What changed
src/test_get_whitelist.rs (new file)
21 tests across 14 categories — all passing in CI (Ubuntu, cargo test).
src/lib.rs
Added '#[cfg(test)] mod test_get_whitelist;' to the test-module registry.
Coverage added
Why each category matters
Public contract preservation
get_whitelist signature and behaviour are unchanged. No production code was modified; the only lib.rs change is the #[cfg(test)] module declaration.
Closes #1107