QA: Verify invariants, business logic, and automated tests #1
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#1
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?
Scope
Validate ust1-window against documented invariants and expected behavior, and confirm the test suite and tooling pass in a clean checkout.
Environment prep
main).rustfmt+clippycomponents.python3 -m venv .venvandpip install -r requirements-dev.txtfor pre-commit.Commands (must all succeed)
cargo fmt --all -- --checkcargo clippy --all-targets -- -D warningscargo test(full workspace)pre-commit run --all-files(if pre-commit installed)Invariants —
ust1-common/ math (INV-MATH-001,INV-SWAP-001,INV-SWAP-002)RmeansR/RATE_SCALEFDUSD per 1 vFDUSD; spot-check forwardvFDUSD → UST1and reverseUST1 → vFDUSDformulas matchust1-common/src/math.rs.DEFAULT_FEE_BPS.Invariants — oracle policy (
INV-ORACLE-THROTTLE-001,INV-ORACLE-DAILY-001,INV-ORACLE-MONO-001)UpdateRate(only flat or increase).last_update_secis rejected (unlesslast_update_sec == 0for first post-init edge — confirm against spec intent).day_baseline_rate * 1.02(baseline updated at UTC day rollover per contract).ust1_common::oracle_policy::check_rate_updatematches contract behavior (service and tests rely on this).Invariants — window (
INV-LIMIT-001)ust1-windowconfig.window_start_sec == 0or after 24h; double-count at boundary is acceptable per product note — confirm behavior is intentional.Business logic — contracts
oracle_operatormayUpdateRate; governance can rotate operator, pause, two-step governance transfer.vfdusd_token,ust1_token);Deposit/Withdrawhooks behave as documented; pause blocks swaps.Integration / manual smoke (optional but recommended)
make start+make wait-healthy(LocalTerra).scripts/): one vFDUSD→UST1 deposit and one UST1→vFDUSD withdraw on local net.CI parity
.gitleaks.toml,.gitlab-ci.ymlsecret-detection template).Sign-off
assigned to @Brouie
@PlasticDigits initial verification pass on 52e4d41 (or current main).
Test baseline
cargo test --workspaceon QA server:Total: 28/28 pass, 0 failures.
Invariants → test coverage
inv_math_001_one_to_one_rate✅prop_fee_never_inverts(proptest) ✅inv_swap_001_fee_reduces_output, E2E deposit ✅Coverage gap
INV-SWAP-002 (reverse: UST1 → vFDUSD math) is documented in
math.rsmodule comments but has no test specifically tagged INV-SWAP-002. The withdraw path is exercised inust1-windowmultitest (withdraw_below_min_vfdusd_out_rejected,withdraw_insufficient_vfdusd_in_window) and the proptestprop_fee_never_invertstouches fee math in both directions, but nothing assertsust1_after_fee_to_vfdusdconforms to the documented formulafloor(u * (BPS_DENOM - fee_bps) / BPS_DENOM * RATE_SCALE / R)on known vectors. Recommend adding a unit test pattern-matchinginv_swap_001_fee_reduces_outputfor the reverse direction with known input/output pairs.Related: this is informational, not a bug. Filing as part of #2 (expand coverage) rather than a separate security issue.
Cross-ref
Pairs with the 9 security findings filed under #5 — those cover behavioral/operational risk. This issue (#1) is baseline test health, which is currently green.
Verification complete for the current state. Will re-run on any contract change and report drift.
mentioned in issue #2
mentioned in issue #18
@PlasticDigits closing per today's dev review. Single outstanding coverage gap (INV-SWAP-002) split out as #18. Verification baseline from yesterday holds: 40/40 workspace tests pass, all INV-* mapped to tests except the one now tracked separately.
mentioned in issue #22
mentioned in commit f312188dd1f8a7c61dc32de5647a58f3e041293e
mentioned in merge request !39
mentioned in merge request !40
mentioned in commit
c1d19c7329mentioned in issue #27