Telegram (ask questions / claim the issue here first): https://t.me/+DOylgFv1jyJlNzM0
Labels: bug, backend, Stellar Wave, database, critical
Two indexers run at once and double-count withdrawnAmount, which corrupts claimable balances.
index.ts:32 calls sorobanIndexerService.start() and index.ts:33 startWorkers() starts SorobanEventWorker. Both poll STREAM_CONTRACT_ID and write Stream/StreamEvent. Their WITHDRAWN handlers both read-then-add withdrawnAmount (soroban-indexer.service.ts:216 and soroban-event-worker.ts:631) in separate transactions, so when both pick up the same event before either commits, the increment lands twice. That inflates withdrawnAmount and shrinks claimable. The legacy service also keeps its cursor in memory and ignores IndexerState. One indexer should own this.
What the fix has to hold to
- Only one component indexes contract events
- The same WITHDRAWN event never increments
withdrawnAmount more than once
Done when
Where to start
backend/src/index.ts (drop the legacy start), then remove backend/src/services/soroban-indexer.service.ts; soroban-event-worker.ts stays as the single indexer. Contract-side and frontend indexer-status UI are out of scope. Medium.
Labels:
bug,backend,Stellar Wave,database,criticalTwo indexers run at once and double-count
withdrawnAmount, which corrupts claimable balances.index.ts:32callssorobanIndexerService.start()andindex.ts:33startWorkers()startsSorobanEventWorker. Both pollSTREAM_CONTRACT_IDand writeStream/StreamEvent. Their WITHDRAWN handlers both read-then-addwithdrawnAmount(soroban-indexer.service.ts:216 and soroban-event-worker.ts:631) in separate transactions, so when both pick up the same event before either commits, the increment lands twice. That inflateswithdrawnAmountand shrinks claimable. The legacy service also keeps its cursor in memory and ignoresIndexerState. One indexer should own this.What the fix has to hold to
withdrawnAmountmore than onceDone when
sorobanIndexerService.start()/stop()removed fromindex.tsso onlySorobanEventWorkerindexesservices/soroban-indexer.service.tsdeleted or disabledwithdrawnAmountisn't double-incremented for the same eventWhere to start
backend/src/index.ts(drop the legacy start), then removebackend/src/services/soroban-indexer.service.ts;soroban-event-worker.tsstays as the single indexer. Contract-side and frontend indexer-status UI are out of scope. Medium.