Tests: expand coverage for oracle, window, limits, and policies #2
Labels
No labels
enhancement
governance
QA
testing
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
code/ust1-window#2
Loading…
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?
Summary
Increase automated test coverage so invariants and business rules are verified in CI, not only via manual QA.
Current gaps
ust1-oracleandust1-windowcrates have no in-crate unit tests (integration tests exist only inust1-integration-tests).UpdateRate, throttle, daily cap, pause, governance, or limit failures.ust1-commonalready has proptest for math/oracle policy; contracts need analogous cw-multi-test scenarios.Proposed work (checklist)
ust1-oracle): cw-multi-test —UpdateRatesuccess/failure for monotonicity, 4h throttle, UTC daily +2% cap, pause, unauthorized sender; governance operator rotation + two-step governance.ust1-window): cw-multi-test — per-tx and rolling 24h limit hits; pause; invalid cw20 sender;Withdrawbelowmin_vfdusd_out; insufficient contract vFDUSD balance.Acceptance criteria
cargo testpasses; no new clippy warnings (-D warnings).mentioned in commit
e974c5db03Issue #2 implementation (merged to
main)Work for expanded automated coverage was implemented on branch
issue/2-test-coverage(git worktree), rebased onto latestmain, and merged. Pushed: commite974c5d.What was added
ust1-oracle: Newsrc/multitest.rs(8 cw-multi-test cases) covering INV-ORACLE-THROTTLE-001, INV-ORACLE-DAILY-001, and INV-ORACLE-MONO-001 via contract paths, plus pause, non-operatorUpdateRate, operator rotation, and two-step governance.ust1-window: Newsrc/multitest.rs(6 cases) for INV-LIMIT-001 (per-tx and rolling 24h), pause, invalid CW20 sender, withdraw belowmin_vfdusd_out, and insufficient contract vFDUSD on withdraw.ust1-integration-tests:deposit_after_oracle_rate_bump_within_daily_capandoracle_second_update_same_day_respects_throttlefor combined oracle + window flows (rebased alongside existingeffective_swap_query_matches_oracle_and_window_configfrom main).cargo testandcargo clippy --all-targets -- -D warningspass.@brouie — could you review and confirm this matches what you want for QA coverage? Leaving this issue open until you sign off.
mentioned in issue #1
@PlasticDigits verified on current main — the proposed work in this checklist is already implemented.
Checklist status
Oracle cw-multi-test (
contracts/ust1-oracle/src/multitest.rs— 8/8 pass):inv_oracle_mono_update_success_within_cap,inv_oracle_mono_decrease_rejected✅inv_oracle_throttle_second_update_too_soon✅inv_oracle_daily_cap_exceeded_same_utc_day✅inv_oracle_pause_blocks_operator_update✅inv_oracle_unauthorized_update_not_operator✅governance_rotates_oracle_operator✅governance_two_step_transfer✅Window cw-multi-test (
contracts/ust1-window/src/multitest.rs— 6/6 pass):inv_limit_001_per_tx_exceeded✅inv_limit_001_rolling_24h_exceeded✅paused_blocks_cw20_flow✅invalid_cw20_sender_rejected✅withdraw_below_min_vfdusd_out_rejected✅withdraw_insufficient_vfdusd_in_window✅Integration (
tests/src/integration_tests.rs):integration_tests.rs:358(INV-ORACLE-DAILY-001 + INV-SWAP-001) ✅integration_tests.rs:445(INV-ORACLE-THROTTLE-001) ✅CI: nightly/manual LocalTerra deploy smoke — marked "defer if too heavy" in the issue, still deferred.
Acceptance criteria
inv_*prefix or tagged INV-LIMIT-001 in module commentcargo test --workspacepasses: 28/28, 0 failures (verified today)-D warningsstill cleanSingle remaining gap (minor)
From the review in #1: INV-SWAP-002 (reverse: UST1 → vFDUSD) is documented in
math.rsmodule comments but has no unit test tagged INV-SWAP-002 specifically.ust1_after_fee_to_vfdusdis exercised via withdraw multitest +prop_fee_never_inverts, but a direct formula-verification test on known vectors (mirror ofinv_swap_001_fee_reduces_output) would be tidy. Low priority — adding to this issue's scope rather than filing separately.Happy for you to either add the INV-SWAP-002 vector test in a trivial MR and close this, or close now with that note parked as "nice to have" followup.
mentioned in issue #18
@PlasticDigits closing per today's dev review. All original checklist items (oracle cw-multi-test, window cw-multi-test, integration combined flows) are implemented. The INV-SWAP-002 vector test followup is now tracked as #18.
mentioned in issue #27