Security: wallet blacklist missing ClaimExpiredLimitOrder, UpdateLimitOrderPrice, and hybrid swap test coverage [SEC-B02] #393
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:implement
agent:implement
agent:open_issues
agent:ready
agent:research
agent:security_audit
agent:verify
architecture
backend
blocker:hybrid
blocker:launch
blocker:limit-orders
blocker:v2
block:log_only
block:security
bug
ci
contracts
correctness
deploy
dev
devops
docs
documentation
duplicate
e2e
enhancement
epic
feature
frontend
functional-completion
gas
good first issue
governance
help wanted
high-risk
hooks
hybrid
indexer
infra
infrastructure
integrators
invalid
launch-blocker
limit-orders
localnet
localterra
low priority
missing-implementation
needs-design
ops
performance
priority
high
priority
medium
product
qa
QA
question
ready
ready
research
scripts
security
security-hardening
smartcontracts
tech-debt
testing
ux
UX
v2
verification
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
code/cl8y-dex-terraclassic#393
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Checklist Item
SEC-B02: Verify wallet blacklist blocks swaps, hybrid swaps, provide liquidity, withdraw liquidity, limit place/cancel/claim/update, and router multihop. Verify: contract tests cover every execute path and unblacklist restores normal execution.
Summary
The wallet blacklist integration test covers swap, limit place, cancel, provide liquidity, withdraw liquidity, and router multihop. Three execute paths listed in the checklist and documented in the security model are absent from the test:
ClaimExpiredLimitOrder,UpdateLimitOrderPrice, and hybrid swap via a blacklisted wallet.What Was Checked
smartcontracts/tests/src/blacklist_tests.rslines 87-203 (wallet_blacklist_blocks_swap_lp_limits_and_unban_restores): full test readsmartcontracts/contracts/pair/src/contract.rslines 659-692: confirmedClaimExpiredLimitOrder,ClaimExpiredLimitOrders, andUpdateLimitOrderPriceare registered execute messagessmartcontracts/tests/src/limit_order_tests.rsline 2035:ClaimExpiredLimitOrderIS tested under pair pause (not wallet blacklist)smartcontracts/tests/src/blacklist_tests.rslines 264-278: hybrid swap tested under token blacklist onlyClaimExpiredLimitandUpdateLimitOrderacross all test files: no results inblacklist_tests.rsdocs/security-model.mdline 139: documents wallet blacklist should block "limit place/cancel/claim/update"Expected (per checklist)
Contract tests must cover every execute path a blacklisted wallet could attempt: swap, hybrid swap, provide liquidity, withdraw liquidity, limit place, limit cancel,
ClaimExpiredLimitOrder,UpdateLimitOrderPrice, and router multihop. Unblacklist must restore normal execution.Actual
The existing test covers 6 of the 9 required paths. Missing:
ClaimExpiredLimitOrderattempt from a blacklisted wallet is not testedUpdateLimitOrderPriceattempt from a blacklisted wallet is not testedEvidence
smartcontracts/tests/src/blacklist_tests.rslines 87-203: swap (118-131), limit place (133-146), cancel (148-157), provide LP (159-182), withdraw LP (186-199), unblacklist restore (201-202) -- no claim, no update, no hybridsmartcontracts/contracts/pair/src/contract.rsline 659:ClaimExpiredLimitOrderregistered execute messagesmartcontracts/contracts/pair/src/contract.rsline 679:UpdateLimitOrderPriceregistered execute messagesmartcontracts/tests/src/blacklist_tests.rslines 264-278: hybrid swap only intoken_blacklist_blocks_swap_both_directions, not in wallet blacklist testsmartcontracts/tests/src/limit_order_tests.rsline 2035:claim_expired_limit_order_blocked_while_pair_paused_then_succeeds_after_unpause-- tests pair pause gate, not wallet blacklistSuggested Fix
Extend
wallet_blacklist_blocks_swap_lp_limits_and_unban_restoresor add a companion test asserting that a blacklisted wallet receives a blacklist rejection on:Cw20HookMsg::Swapwith a non-NonehybridparamClaimExpiredLimitOrderwith a known expired order IDUpdateLimitOrderPricewith a known active order IDVerification Checklist
ClaimExpiredLimitOrderfrom a blacklisted wallet is tested and returns a blacklist errorUpdateLimitOrderPricefrom a blacklisted wallet is tested and returns a blacklist errorLabels
security,pre-launchCc: @PlasticDigits
mentioned in commit
64a9161040mentioned in merge request !923
mentioned in issue #381
mentioned in commit
2725fdb323Verification — SEC-B02 / #393
Verified on
mainat64ae4724(fix merged viaissue-393-wallet-blacklist-test-coverage, commit64a91610).Checklist
blacklist_tests::wallet_blacklist_blocks_swap_lp_limits_and_unban_restoreslines 263–287 assertis_blacklisted_erronCw20HookMsg::Swapwithhybrid: Some(pool_only_hybrid_params(...))afterBlacklistWalletClaimExpiredLimitOrderfrom a blacklisted wallet returns a blacklist errorExecuteMsg::ClaimExpiredLimitOrder { order_id: expired_order_id }UpdateLimitOrderPricefrom a blacklisted wallet returns a blacklist errorExecuteMsg::UpdateLimitOrderPricefor activeorder_idcargo test blacklist_tests— 8/8 passed;make test-contracts— full suite green (385 tests)Additional SEC-B02 scope (from issue body)
blacklist_tests::router_multihop_rejects_blacklisted_walletswap_a_to_bsucceeds afterUnblacklistWallet)Docs / invariants
docs/security-model.mdanddocs/contracts-security-audit.mdmatrix row B1 already reference SEC-B02 / #393 and the extended test coverage. No doc drift found.No repository changes required. Closing as verified.