fix(indexer): remove duplicate soroban indexer service (#801)#980
Open
Banx17 wants to merge 1 commit into
Open
fix(indexer): remove duplicate soroban indexer service (#801)#980Banx17 wants to merge 1 commit into
Banx17 wants to merge 1 commit into
Conversation
- Removed legacy `sorobanIndexerService` from `index.ts`. - Made `SorobanEventWorker.handleTokensWithdrawn` idempotent. - Deleted obsolete tests for legacy service. - Added regression test for single indexer LabsCrypt#801.
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.
[npm run lint ✅ completed (existing repo warnings only)
npm run typecheck ✅ passed
npm run build ✅ passed]
Overview
This PR resolves a race condition where two indexers (
soroban-indexer.serviceandsoroban-event-worker) were running concurrently, leading to a double-counting ofwithdrawnAmountfor the same events. The legacy service has been removed so that only theSorobanEventWorkerpolls the contract. Additionally, the WITHDRAWN handler has been made idempotent to guarantee that the same event cannot increment the balance more than once.Related Issue
Closes #801
Changes
⚙️ Indexer Consolidation
backend/src/services/soroban-indexer.service.tsbackend/src/index.tssorobanIndexerService.start()call and related graceful shutdown logic.🛡️ Idempotency Improvements
backend/src/workers/soroban-event-worker.tshandleTokensWithdrawnto check for the existingStreamEventrecord before applying the balance increment, preventing double-counting if the same event is processed twice.🧪 Tests
backend/tests/soroban-indexer.test.tsbackend/tests/single-indexer.regression.test.tswithdrawnAmountis not double-incremented when the same WITHDRAWN event is observed.Verification Results
sorobanIndexerService.start()/stop()fromindex.tsservices/soroban-indexer.service.tswithdrawnAmountis not double-incremented when the same WITHDRAWN event is observed