feat: debounce/throttle duplicate proof-verification calls (#1974) - #2133
Merged
RUKAYAT-CODER merged 3 commits intoJul 30, 2026
Merged
Conversation
Add VerificationDedupService that deduplicates in-flight verification requests per submission ID and caches recent successful results briefly. - In-flight dedup: concurrent approve calls for the same submission share a single promise instead of starting redundant on-chain work. - Result cache: successful verification results cached for 5 seconds, avoiding re-execution of DB lookups, CAS updates, and chain calls. - Failures are never cached, so legitimate retries (post-rollback) work. - New metrics: submission_approval_dedup_hits_total and submission_approval_cache_hits_total. - Documentation in docs/VERIFICATION_DEDUP.md. Closes EarnQuestOne#1974
|
@Chinonso-Peter 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! 🚀 |
Contributor
Author
|
@RUKAYAT-CODER please review |
Contributor
|
kindly resolve conflict |
Contributor
|
Thank you for contributing to the project. |
4 tasks
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
Adds two-layer deduplication for proof-verification (approve) requests:
approveSubmissioncalls for the same submission ID share a single promise, avoiding redundant on-chainapprove_submissioninvocations.Changes
VerificationDedupService(src/common/services/verification-dedup.service.ts) — generic in-flight dedup + TTL result cache.SubmissionsService.approveSubmissionnow delegates throughVerificationDedupService.executeWithDedupwith keyapprove:<submissionId>.submission_approval_dedup_hits_total(in-flight reuse) andsubmission_approval_cache_hits_total(cache hit).SubmissionsModuleupdated to provideVerificationDedupService.VerificationDedupService(12 tests) and dedup integration inSubmissionsService(4 new tests).docs/VERIFICATION_DEDUP.md.Before/After
Tests
All 26 related tests pass (12 dedup service + 14 submissions service). 1018 other tests unchanged. No regression.
Closes #1974