fix(pair): skip blacklisted maker orders during limit book fills (#468) #1009
No reviewers
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!1009
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/468-blacklisted-maker-fill-gate"
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?
Summary
Fixes GitLab #468:
BlacklistWalletpreviously gated only the taker on swap entry. Resting limit orders owned by a blacklisted maker could still fill, paying offer-token CW20 into the frozen wallet.Changes:
TradeBlacklistGate+wallet_is_trade_blacklistedin pairblacklist_guard.rsmatch_bids/match_asksskip blacklistedorder.owner; when park budget allows, unlink intoEXPIRED_LIMIT_CLAIMSviapark_limit_order_for_clean(..., force_expired=true)— no offer-token payoutsimulate_match_*skips blacklisted makers read-only for quote/execute parityblacklisted_maker_resting_limit_not_filled_taker_can_still_swaplimit-orders.md,security-model.md, user FAQ,AGENTS_BLACKLIST_DECISION.mdAcceptance checklist
cd smartcontracts && cargo test -p cl8y-dex-tests blacklisted_maker_resting_limit_not_filledmaker_token_a_after == maker_token_a_before)ExpiredLimitRefundquery for order_id 1)cd smartcontracts && cargo test -p cl8y-dex-tests blacklist_tests -- --test-threads=1cd smartcontracts && cargo test -p cl8y-dex-pair orderbook -- --test-threads=1make test-contractsdocs/contracts-security-audit.mddocs/limit-orders.md,docs/security-model.mdskills/AGENTS_BLACKLIST_DECISION.mdThird-party verification
Confirm
docs/contracts-security-audit.mdrow L19 and B1 reference #468.Bugbot is not enabled for your account, so this pull request was not reviewed.
Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.
Security review — MR !1009
Commit reviewed:
48bee6ae44a88c2a9e9b19946fe4f9cf4bd0b72eScope: Pair contract maker-side trading blacklist gate during hybrid limit-book fills (
blacklist_guard.rs,orderbook.rs,contract.rswiring), integration test, and documentation updates for GitLab #468 / invariant L19.Outcome
FINDINGS: 0 (no medium, high, or critical issues on this diff)
Summary
This MR closes a real compliance gap: resting limit orders owned by a wallet-blacklisted maker could still fill and pay offer-token CW20 to the frozen address. The fix is sound:
skip_blacklisted_maker_orderruns before fill math inmatch_bids/match_asks; blacklisted makers are never credited viamaker_payouts.wallet_is_trade_blacklisteduses the sameprobe_factory_blacklistpath as taker entry (#456); factoryBlacklistCheckerrors abort the swap (BlacklistGuardUnavailable), not fail-open.park_limit_order_for_clean(..., force_expired=true)(L1 path) — unlink only, no CW20 in the taker tx; claim remains pause/blacklist-gated untilUnblacklistWallet.MAX_EXPIRED_PARKS_PER_SWAPis exhausted, blacklisted rows are still skipped (not filled); they may remain on-book until a later walk parks them — same pattern as expired-head handling, not a payout bypass.simulate_match_*skips blacklisted makers read-only; execute skips (and parks when budget allows). Fill accounting aligns for the same snapshot.blacklisted_maker_resting_limit_not_filled_taker_can_still_swapcovers no maker payout + off-book park.Candidate paths reviewed (not reported)
book_start_hintskip_blacklisted_maker_orderstill applies forward — no fill bypassBlacklistCheckincludes pair tokens + pair address; blocked makers skipped — consistent with B1MAX_SCAN_STEPS(500); mitigated bybook_start_hint/ head-clog patterns (#289); capital required for deep-book griefingdb_orderbook_simunchangedInline threads
None — zero medium+ findings.
Security review: no medium+ findings on this diff.
mentioned in commit
529b34e1a7