Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

[Backend] handleTokensWithdrawn increments withdrawnAmount before the dedup guard - replay/reset double-counts and corrupts claimable

Offen
#802 8 Kommentare 0 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

Maintainer antworten meist innerhalb von 3 Tagen

@jadonamite arbeitet bereits daran.

Seit 30.6.2026.

  • #968 von @jadonamite — offen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Beschreibung

backend bug critical database GrantFox OSS Maybe Rewarded Official Campaign | FWC26 Stellar Wave

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 withdrawnAmount only changes when the StreamEvent row is newly created, in the same transaction
  • Replay/reset is genuinely idempotent

Done when

  • withdrawnAmount update is idempotent (mutate only on a new StreamEvent insert, same tx)
  • Test processes the same tokens_withdrawn event twice and asserts withdrawnAmount changes once
  • handleStreamCancelled/handleStreamCompleted audited 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

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus LabsCrypt/flowfi

Alle Issues in LabsCrypt/flowfi

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.