Skip to content

feat(rewards): add proof-size limits and pagination coverage#884

Merged
edehvictor merged 1 commit into
edehvictor:mainfrom
dannyy2000:feat/830-840-837-839
Jun 27, 2026
Merged

feat(rewards): add proof-size limits and pagination coverage#884
edehvictor merged 1 commit into
edehvictor:mainfrom
dannyy2000:feat/830-840-837-839

Conversation

@dannyy2000

Copy link
Copy Markdown
Contributor

Summary

  • Adds MAX_PROOF_DEPTH (20) and MAX_BATCH_ENTRIES (10 000) constants to merkleTree.ts and exposes validateProofSize() so callers can reject oversized proofs before they reach the on-chain verifier.
  • Adds paginateVaultResults() and MAX_VAULTS_PER_PAGE (50) to batchClaimUtils.ts so large vault lists are always served in bounded pages.
  • 30 new backend tests (proofSizeLimits.test.ts): proof-depth boundary per tree size, validateProofSize accept/reject, large-batch correctness up to MAX_BATCH_ENTRIES, safe degradation for oversized inputs, and pagination consistency.
  • 31 new client tests (batchClaimPagination.test.ts): page slicing, pageSize clamping, out-of-range page clamping, overflow protection for 500-vault batches, metadata accuracy, mixed-status large batches, and BigInt edge amounts.

Test plan

  • cd backend/rewards && npx jest proofSizeLimits — 30 tests pass
  • cd client && npx vitest run src/features/rewards/batchClaimPagination.test.ts — 31 tests pass
  • Existing merkleTree.test.ts, generateTree.test.ts, and batchClaimUtils.test.ts suites remain green

Related issues

Closes #830
Closes #837
Closes #839
Closes #840

…tor#830)

- Add MAX_PROOF_DEPTH (20) and MAX_BATCH_ENTRIES (10 000) constants to
  merkleTree.ts; expose validateProofSize() for callers to reject
  oversized proofs before they reach the on-chain verifier.
- Add paginateVaultResults() and MAX_VAULTS_PER_PAGE (50) to
  batchClaimUtils.ts so large vault lists are served in bounded pages.
- New test suite backend/rewards/src/__tests__/proofSizeLimits.test.ts
  (30 tests): proof-depth boundary per tree size, validateProofSize
  accept/reject, large-batch correctness up to MAX_BATCH_ENTRIES, safe
  degradation for oversized inputs, and pagination consistency checks.
- New test suite client/src/features/rewards/batchClaimPagination.test.ts
  (31 tests): page slicing, pageSize clamping, out-of-range page
  clamping, overflow protection for 500-vault batches, metadata
  accuracy, mixed-status large batches, and BigInt edge amounts.
@dannyy2000 dannyy2000 requested a review from edehvictor as a code owner June 27, 2026 10:40
@vercel

vercel Bot commented Jun 27, 2026

Copy link
Copy Markdown

@dannyy2000 is attempting to deploy a commit to the Edeh Victor's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jun 27, 2026

Copy link
Copy Markdown

@dannyy2000 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

@edehvictor edehvictor left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice implementation!

@edehvictor edehvictor merged commit bf32613 into edehvictor:main Jun 27, 2026
4 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants