[Backend] handleTokensWithdrawn increments withdrawnAmount before the dedup guard - replay/reset double-counts and corrupts claimable
Maintainer antworten meist innerhalb von 3 Tagen
Bewertung
Dieses Issue wurde noch nicht bewertet.
Beschreibung
Telegram (ask questions / claim the issue here first): https://t.me/+DOylgFv1jyJlNzM0
Labels: bug, backend, Stellar Wave, database, critical
The withdrawn-amount update runs before the dedup check, so replaying events under-pays recipients.
soroban-event-worker.ts:631-641 computes newWithdrawnAmount = BigInt(stream.withdrawnAmount) + BigInt(amount) and calls tx.stream.update unconditionally. The dedup check at line 643 only guards inserting the StreamEvent row, not the financial field. So when the admin POST /v1/admin/indexer/replay resets the cursor and re-polls the same ledgers, every replay adds amount again even though the StreamEvent row is skipped. withdrawnAmount inflates, claimable shrinks, and the recipient is short-changed. The replay endpoint's Swagger doc even claims it's idempotent.
What the fix has to hold to
- The stream's
withdrawnAmountonly changes when theStreamEventrow is newly created, in the same transaction - Replay/reset is genuinely idempotent
Done when
-
withdrawnAmountupdate is idempotent (mutate only on a newStreamEventinsert, same tx) - Test processes the same
tokens_withdrawnevent twice and assertswithdrawnAmountchanges once -
handleStreamCancelled/handleStreamCompletedaudited to confirm they stay idempotent - Tests + lint pass, CI green
Where to start
backend/src/workers/soroban-event-worker.ts for the ordering fix; indexerService.ts and admin.routes.ts are listed for the replay path and audit. On-chain event schema is out of scope. Medium.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 18
- Forks
- 250
- Ø Merge
- 4 T. 12 Std.
- Gemergte PRs (30 T.)
- 65
Entwicklungsumgebung
- Enthält ein Dockerfile oder eine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus LabsCrypt/flowfi
-
[test] Cover indexed fee event accountingEvtl. vergeben @huangji6693-max hat das vor 2 Tagen übernommen. Offenbackend points: 150 testing
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
LabsCrypt/flowfi#1764 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 3 Tagen
-
backend points: 150 testing
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Maintainer antworten meist innerhalb von 3 Tagen
-
backend points: 150 testing
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 3 Tagen
-
backend points: 150 testing
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Maintainer antworten meist innerhalb von 3 Tagen
-
[test] Cover admin ledger reset validationEvtl. vergeben @Ranjeet2063 hat das vor 1 Tag übernommen. Offenbackend points: 150 testing
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Maintainer antworten meist innerhalb von 3 Tagen
Alle Issues in LabsCrypt/flowfi
Ähnliche Issues
-
area:plugins area:security area:skills bug has repro
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
anthropics/claude-code#105911 ·
Maintainer antworten meist innerhalb von 1 Tag
-
openspec-apply-change skill: when blocked, may select a ready artifact unrelated to missingArtifactsOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Fission-AI/OpenSpec#2165 ·
Maintainer antworten meist innerhalb von 1 Tag
-
🐞 bug 🧐 unconfirmed
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
Tencent/tdesign-vue-next#7032 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
gnosis/gnosis_vpn#661 ·
Maintainer antworten meist innerhalb von 1 Tag
-
content-freshness: staleOwnedContent doc comments still say 'complete receipt' (follow-up to #7912)Offentriage:bug-verified
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 92/100
Maintainer antworten meist innerhalb von 1 Tag