feat(rewards): add proof-size limits and pagination coverage#884
Merged
Conversation
…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 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. |
|
@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! 🚀 |
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
MAX_PROOF_DEPTH(20) andMAX_BATCH_ENTRIES(10 000) constants tomerkleTree.tsand exposesvalidateProofSize()so callers can reject oversized proofs before they reach the on-chain verifier.paginateVaultResults()andMAX_VAULTS_PER_PAGE(50) tobatchClaimUtils.tsso large vault lists are always served in bounded pages.proofSizeLimits.test.ts): proof-depth boundary per tree size,validateProofSizeaccept/reject, large-batch correctness up toMAX_BATCH_ENTRIES, safe degradation for oversized inputs, and pagination consistency.batchClaimPagination.test.ts): page slicing,pageSizeclamping, 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 passcd client && npx vitest run src/features/rewards/batchClaimPagination.test.ts— 31 tests passmerkleTree.test.ts,generateTree.test.ts, andbatchClaimUtils.test.tssuites remain greenRelated issues
Closes #830
Closes #837
Closes #839
Closes #840