Skip to content

fix(vault): route invest, divest, and yield state writes through invariant gate (#1631) - #1689

Open
Awosdot wants to merge 1 commit into
Junirezz:mainfrom
Awosdot:feature/issue-1631-route-accounting-invariant-checks
Open

Awosdot wants to merge 1 commit into
Junirezz:mainfrom
Awosdot:feature/issue-1631-route-accounting-invariant-checks

Conversation

@Awosdot

@Awosdot Awosdot commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

What changed

  • Updated invest, divest, and accrue_korean_debt_yield accounting writes in contracts/vault/src/lib.rs to route state persistence through persist_accounting_state[cite: 13].
  • Ensured assert_vault_state_invariants validates state changes across all state-mutating paths before writing DataKey::State to storage[cite: 13].
  • Added integration test verifying that a full invest of the idle balance results in valid invariant state[cite: 13].
  • Added test coverage confirming withdrawals following a full invest return appropriate typed responses without breaking invariant assertions[cite: 13].

Why

Direct writes to VaultState bypassed assert_vault_state_invariants, allowing invalid states where total_shares > 0 and total_assets <= 0, leading to unhandled MathOverflow panics on subsequent operations[cite: 13].

How tested

  • Ran cargo test across all contract packages to confirm invariant assertion and accounting test suites pass cleanly[cite: 13].

Closes

Closes #1631

… dedupe routes (Junirezz#1648)

- ConfirmationModal & WithdrawalConfirmationModal now use the shared
  useFocusTrap hook, ignore backdrop clicks and Escape while processing,
  expose dialog/aria-modal/aria-labelledby, and route all copy through t()
- Drawer adopts useFocusTrap so focus is restored on both close and unmount
- ToastCenter closes on Escape, moves focus into the panel, and stays a
  non-modal, non-scroll-locking popover
- useFocusTrap gains trapTab and lockScroll options (backward compatible)
- App.tsx drops duplicate route/ErrorBoundary definitions and wraps the
  not-found route in RouteErrorBoundary
- Remove stale tracked build/test artifacts and extend .gitignore + README
- Repair invalid root package.json (duplicate test script + trailing comma)
- Add modal, drawer, toast-center and routing smoke tests

Closes Junirezz#1620
Closes Junirezz#1621
Closes Junirezz#1629
Closes Junirezz#1564

Co-authored-by: trinnode <trinnode@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[contract] Route invest, divest and korean yield accounting writes through the invariant check

1 participant