tests: fix decimals bootstrap test after #456 fail-closed guard #999

Merged
PlasticDigits merged 1 commit from qa/456-blacklist-verify-test-fix into main 2026-07-01 01:11:33 +00:00
PlasticDigits commented 2026-07-01 00:44:41 +00:00 (Migrated from gitlab.com)

Summary

Verification of GitLab #456 (SEC-I03 F02) found the fail-closed blacklist guard fix is merged and correct on main, but pair_coverage_tests::test_empty_pool_provide_rejects_asset_decimals_above_bootstrap_cap still used a fake factory address. After #456, provide_liquidity now correctly returns Blacklist guard unavailable before the decimals check runs. This MR instantiates a real factory (with both CW20 code IDs whitelisted) so the test continues to assert the bootstrap decimal-cap rejection path.

Acceptance checklist (#456)

Item Result How verified
Error arm on factory query blocks (no silent fail-open) PASS Code review: pair/src/blacklist_guard.rs and router/src/blacklist_guard.rs map Err(_) → BlacklistGuardUnavailable
Test: factory query error blocks operation PASS cargo test factory_blacklist_query_error_blocks_swap — swap rejected with Blacklist guard unavailable
Docs updated (pre-1.5.0 compat removed) PASS docs/security-model.md, docs/contracts-security-audit.md, skills/AGENTS_BLACKLIST_DECISION.md document fail-closed posture
PlasticDigits comment: drop pre-1.5.0 fail-open PASS dex_common::blacklist::blacklist_query_error_blocks removed in f5085087; default-deny on all query errors
Full contract suite PASS (with this MR) make test-contracts — 389/389 after test fix
Blacklist decision docs drift PASS make check-blacklist-decision-docs

Follow-ups

  • Optional: add a router-path integration test mirroring factory_blacklist_query_error_blocks_swap (router guard already fail-closed in code; only pair path is regression-tested today).
## Summary Verification of GitLab #456 (SEC-I03 F02) found the fail-closed blacklist guard fix is merged and correct on `main`, but `pair_coverage_tests::test_empty_pool_provide_rejects_asset_decimals_above_bootstrap_cap` still used a fake factory address. After #456, `provide_liquidity` now correctly returns `Blacklist guard unavailable` before the decimals check runs. This MR instantiates a real factory (with both CW20 code IDs whitelisted) so the test continues to assert the bootstrap decimal-cap rejection path. ## Acceptance checklist (#456) | Item | Result | How verified | |------|--------|--------------| | Error arm on factory query blocks (no silent fail-open) | **PASS** | Code review: `pair/src/blacklist_guard.rs` and `router/src/blacklist_guard.rs` map `Err(_)` → `BlacklistGuardUnavailable` | | Test: factory query error blocks operation | **PASS** | `cargo test factory_blacklist_query_error_blocks_swap` — swap rejected with `Blacklist guard unavailable` | | Docs updated (pre-1.5.0 compat removed) | **PASS** | `docs/security-model.md`, `docs/contracts-security-audit.md`, `skills/AGENTS_BLACKLIST_DECISION.md` document fail-closed posture | | PlasticDigits comment: drop pre-1.5.0 fail-open | **PASS** | `dex_common::blacklist::blacklist_query_error_blocks` removed in `f5085087`; default-deny on all query errors | | Full contract suite | **PASS** (with this MR) | `make test-contracts` — 389/389 after test fix | | Blacklist decision docs drift | **PASS** | `make check-blacklist-decision-docs` | ## Follow-ups - Optional: add a router-path integration test mirroring `factory_blacklist_query_error_blocks_swap` (router guard already fail-closed in code; only pair path is regression-tested today).
PlasticDigits commented 2026-07-01 00:46:19 +00:00 (Migrated from gitlab.com)

Security review

Commit reviewed: e23df4a270ff1cac6f0bfc07573a3a5a1ac40304
Scope: smartcontracts/tests/src/lib.rs — pair_coverage_tests::test_empty_pool_provide_rejects_asset_decimals_above_bootstrap_cap only (replaces fake factory address with in-test factory instantiation so the decimals bootstrap-cap assertion runs past the #456 fail-closed blacklist guard).

Method: Diff review; traced attacker-controlled inputs to sinks in changed lines; compared factory setup to adjacent test_create_pair_rejects_cw20_above_bootstrap_decimal_cap in the same module.

Outcome: FINDINGS: 0 medium+

Security review: no medium+ findings on this diff.

Rationale: Changes are confined to cw-multi-test harness code and do not alter production contracts, indexer, or frontend. The added factory InstantiateMsg (governance/treasury, whitelisted CW20 code IDs including the adversarial shim, standard fee/limit defaults) matches an established regression pattern already used in this file. No new auth surfaces, injection sinks, secret handling, or on-chain permission boundaries are introduced; the test still asserts ProvideLiquidity rejection for asset decimals above the bootstrap cap.

Inline threads: none (no findings).

## Security review **Commit reviewed:** `e23df4a270ff1cac6f0bfc07573a3a5a1ac40304` **Scope:** `smartcontracts/tests/src/lib.rs` — `pair_coverage_tests::test_empty_pool_provide_rejects_asset_decimals_above_bootstrap_cap` only (replaces fake factory address with in-test factory instantiation so the decimals bootstrap-cap assertion runs past the #456 fail-closed blacklist guard). **Method:** Diff review; traced attacker-controlled inputs to sinks in changed lines; compared factory setup to adjacent `test_create_pair_rejects_cw20_above_bootstrap_decimal_cap` in the same module. **Outcome:** `FINDINGS: 0` medium+ Security review: no medium+ findings on this diff. **Rationale:** Changes are confined to cw-multi-test harness code and do not alter production contracts, indexer, or frontend. The added factory `InstantiateMsg` (governance/treasury, whitelisted CW20 code IDs including the adversarial shim, standard fee/limit defaults) matches an established regression pattern already used in this file. No new auth surfaces, injection sinks, secret handling, or on-chain permission boundaries are introduced; the test still asserts `ProvideLiquidity` rejection for asset decimals above the bootstrap cap. **Inline threads:** none (no findings).
PlasticDigits commented 2026-07-01 01:11:34 +00:00 (Migrated from gitlab.com)

mentioned in commit 45d7dacb1e

mentioned in commit 45d7dacb1eeb928c8a992fd2126f2ae393d3a72d
PlasticDigits (Migrated from gitlab.com) merged commit 45d7dacb1e into main 2026-07-01 01:11:34 +00:00
PlasticDigits commented 2026-07-01 01:14:03 +00:00 (Migrated from gitlab.com)

mentioned in issue #456

mentioned in issue #456
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
code/cl8y-dex-terraclassic!999
No description provided.