Skip to content

feat: KYC upload progress, swap fuzz tests, random_gen storage limits revenue batch payouts#671

Open
king-aj-the-first wants to merge 1 commit into
ceejaylaboratory:mainfrom
king-aj-the-first:feat/KYC
Open

feat: KYC upload progress, swap fuzz tests, random_gen storage limits revenue batch payouts#671
king-aj-the-first wants to merge 1 commit into
ceejaylaboratory:mainfrom
king-aj-the-first:feat/KYC

Conversation

@king-aj-the-first

@king-aj-the-first king-aj-the-first commented Jun 27, 2026

Copy link
Copy Markdown

closes #564
closes #573
closes #582
closes #584

Summary

This PR closes four related issues across the dashboard and Soroban contracts:


#584 — Dashboard: KYC upload progress bar

Problem: The KYC tab showed status previews only; there was no document upload flow or upload progress feedback.

Changes:

  • Added UploadProgressBar — accessible progress bar (role="progressbar", ARIA attributes) styled to match the dashboard gradient pattern
  • Added KycDocumentUpload — file inputs per document field with per-file upload state (idleuploadingcomplete / error)
  • Added uploadDocument service using the SEP-12 presigned URL flow:
    1. POST /sep12/customer/upload-url
    2. PUT to presigned URL via axios onUploadProgress
    3. POST /sep12/customer/upload-confirm
  • Extended FieldRequirement with type: 'file' and accept
  • Wired KycStatusView with apiBaseUrl + wallet account from App.tsx
  • Added default KYC document fields: id_photo_front, proof_of_address

Files:

  • dashboard/src/components/UploadProgressBar.tsx
  • dashboard/src/components/KycDocumentUpload.tsx
  • dashboard/src/lib/kyc/uploadDocument.ts
  • dashboard/src/components/KycStatusView.tsx
  • dashboard/src/types.ts
  • dashboard/src/App.tsx

#564 — Swap contract slippage fuzz tests

Problem: Slippage math lived inline in MultiAssetSwap::swap with only one panic-based unit test.

Changes:

  • Extracted pure math into SwapMath with checked arithmetic:
    • apply_fee, swap_step_zero_for_one, swap_step_one_for_zero
    • meets_slippage, calculate_dynamic_fee_bps, simulate_swap_output
  • Added proptest integration suite at contracts/swap/tests/fuzz_slippage.rs covering:
    • Fee bounds and monotonicity
    • Slippage guard (min_amount_out)
    • Extreme rate / liquidity edge cases
    • Zero-liquidity and overflow-safe behavior
  • Enabled std in test builds via #![cfg_attr(not(test), no_std)]

#573 — random_gen storage limits review
Problem: min_commits was unbounded; commit/reveal persistent entries were never cleaned up; no operator documentation.

Changes:

Added MAX_PARTICIPANTS = 64 — enforced at initialize and commit
Added storage_limits() view for auditors/operators
Post-finalize cleanup: removes ephemeral Commit / Reveal persistent keys and the Committers vec after seed generation
Added contracts/random_gen/README.md with storage layout, footprint formula, and audit notes
Added tests: test_rejects_excessive_min_commits, test_storage_limits_documented
Footprint (during ceremony): up to 2 × min_commits persistent entries; after finalize only RandomSeed + protocol state remain.

#582 — revenue_distributor payout loop optimization
Problem: Single-token distribute() was O(1), but multi-token payout paths would risk exceeding Soroban instruction limits if implemented as unbounded loops.

Changes:

Extracted distribute_token helper (shared split + transfer logic)
Added register_payout_token (admin) to maintain a token registry
Added distribute_batch(start_index, max_tokens) with MAX_TOKENS_PER_BATCH = 10 cap
Persists PayoutCursor for keeper/off-chain pagination across calls
Added test_distribute_batch_bounded
Usage pattern: keepers call distribute_batch(0, 10), then resume from returned cursor until 0.

Run:

cargo test -p swap --test fuzz_slippage
PROPTEST_CASES=10000 cargo test -p swap --test fuzz_slippage

@drips-wave

drips-wave Bot commented Jun 27, 2026

Copy link
Copy Markdown

@king-aj-the-first 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! 🚀

Learn more about application limits

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

Labels

None yet

Projects

None yet

1 participant