Skip to content

Add unit tests for admin wallet blacklist rejecting buy/sell/registration - #702

Merged
Chucks1093 merged 8 commits into
accesslayerorg:mainfrom
akintewe:feat/wallet-blacklist-issue-700
Aug 23, 2026
Merged

Add unit tests for admin wallet blacklist rejecting buy/sell/registration#702
Chucks1093 merged 8 commits into
accesslayerorg:mainfrom
akintewe:feat/wallet-blacklist-issue-700

Conversation

@akintewe

Copy link
Copy Markdown
Contributor

Summary

  • Adds an admin-managed wallet blacklist to creator-keys: blacklist_wallet / remove_from_blacklist admin entrypoints, a is_wallet_blacklisted read-only view, and a new ContractError::WalletBlacklisted variant.
  • Wires the blacklist check into buy_key / buy_key_with_referrer, sell_key, and register_creator so a blacklisted wallet is rejected with WalletBlacklisted before any state mutation.
  • Adds creator-keys/tests/wallet_blacklist.rs covering:
    • Blacklisted wallet reverts on buy with WalletBlacklisted and leaves supply/balance unchanged
    • Blacklisted wallet reverts on sell with WalletBlacklisted and leaves balance unchanged
    • Blacklisted wallet reverts on register_creator with WalletBlacklisted and leaves the creator unregistered
    • Removing a wallet from the blacklist restores buy/sell/registration access
    • Non-admin callers cannot call blacklist_wallet or remove_from_blacklist
    • Blacklisting one wallet does not affect any other wallet's access

Test plan

  • No commands were run per task instructions; tests are written to mirror the existing emergency_pause.rs / admin_unauthorized.rs integration-test patterns in this crate (try_* client calls asserted against Err(Ok(ContractError::...))).

closes #700

Adds ContractError::WalletBlacklisted, a Blacklisted(Address) DataKey,
and is_blacklisted/assert_not_blacklisted helpers backing the admin
wallet blacklist feature.
Covers the buy path from issue accesslayerorg#700: a blacklisted buyer must be
rejected and must not mutate supply or balance state.
Covers the sell path from issue accesslayerorg#700: a blacklisted seller must be
rejected and must not mutate their key balance.
Covers the registration path from issue accesslayerorg#700: a blacklisted wallet
must not be able to register as a creator.
Covers the removal path from issue accesslayerorg#700: buy, sell, and registration
must all succeed again once the admin lifts the block.
Covers the admin-only acceptance criterion from issue accesslayerorg#700: neither
blacklist_wallet nor remove_from_blacklist may be called by a
non-admin, and storage state is unchanged when rejected.
Adds a regression covering that blacklisting one wallet does not
block trading for any other, unrelated wallet.
CI's format check failed because the parameter list exceeded rustfmt's
line width. Verified locally with cargo fmt --check, cargo clippy
-D warnings, and cargo test --workspace (all pass).
@Chucks1093
Chucks1093 merged commit 4e53f52 into accesslayerorg:main Aug 23, 2026
1 check passed
@Chucks1093

Copy link
Copy Markdown
Member

Good implementation Akintewe

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.

Add unit tests for the contract rejecting any call from a wallet that has been blacklisted by the admin

2 participants