Repository navigation
Vault e2e tests, API hardening, pagination/caching, and loss recognition - #343
Merged
techisigu merged 9 commits intoOct 24, 2026
Merged
Conversation
…Deposit, Withdraw Closes Zenith-options#219
… Scoping, and Abu Closes Zenith-options#220
…Performance for V Closes Zenith-options#223
…ialized-Loss Hand Closes Zenith-options#225
|
@BethelDev-io Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
- src/env.ts: merged [markers] — model resolved the conflict markers - src/lib/api/vaults.ts: merged [markers] — model resolved the conflict markers Co-authored-by: Simple Agent <agent@simple.dev>
- src/env.ts: merged [markers] — model resolved the conflict markers - src/lib/api/vaults.ts: merged [markers] — model resolved the conflict markers Co-authored-by: Simple Agent <agent@simple.dev>
- src/lib/api/vaults.ts: merged [markers] — model resolved the conflict markers Co-authored-by: Simple Agent <agent@simple.dev>
- src/lib/api/vaults.ts: merged [markers] — model resolved the conflict markers Co-authored-by: Simple Agent <agent@simple.dev>
- src/lib/api/vaults.ts: merged [markers] — model resolved the conflict markers Co-authored-by: Simple Agent <agent@simple.dev>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Vault e2e tests, API hardening, pagination/caching, and loss recognition
What was solved
#219 — Add Playwright End-to-End Coverage for Vault Deposit, Withdrawal, and Epoch Flows
Extend the existing Playwright harness with mocked-backend vault coverage: add vault fixtures/routes to e2e/mockBackend.ts, add vault spec files for deposit, queued withdrawal/redemption, epoch/capacity states, error handling, and the NEXT_PUBLIC_VAULTS disabled fallback, plus visual baselines and CI wiring. Tests must run across existing Playwright projects against the mocked backend only.
Addressed:
#220 — Harden the Vault API With Rate Limiting, Auth Scoping, and Abuse Protection
Harden the vault REST surface and its BFF proxy routes with per-wallet/per-IP rate limiting, explicit read/write/operator auth scopes, strict server-side amount/vault-id/pagination validation, idempotency-based replay protection, structured audit logging of state-changing requests, and CSRF/origin checks on BFF write routes — enforced authoritatively at the backend vault service and re-checked cheaply at the BFF, with per-environment configurable limits.
Addressed:
#223 — Implement Caching, Pagination, and Read-Path Performance for Vault List and Epoch History Endpoints
Add cursor-based pagination, server-side caching with freshness metadata, and N+1 elimination to the vault list and epoch history read paths, plus a typed paginated client in src/lib/api/vaults.ts. Scope is limited to the read path: no write-path changes, no contract-level RPC batching, and no CDN caching configuration.
Addressed:
#225 — Implement Vault Insolvency, Bad-Debt, and Socialized-Loss Handling
Implement a deterministic vault loss-recognition waterfall (fee reserves → first-loss buffer → pro-rata share write-down) invoked only from settlement/epoch-close, emitting a structured VaultLossEvent persisted in the epoch ledger, clamping NAV/share at zero with residual bad debt recorded explicitly, disabling deposits while impaired, and surfacing loss fields through the vault API types and vault detail UI impaired/underwater state.
Addressed:
Changes
e2e/mockBackend.ts(modify)src/lib/api/vaults.ts(modify)e2e/vaults.spec.ts(create)src/env.ts(modify)playwright.config.ts(modify)Approach
Issues
Closes #219
Closes #220
Closes #223
Closes #225