Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

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

未关闭
#802 8 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 7 天内回复

@jadonamite 已经在做这个了。

开始于 2026年6月30日。

  • #968 来自 @jadonamite —— 未关闭

评估

这个 Issue 还没有评估数据。

描述

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.

主要语言
TypeScript
星标
18
派生
250
平均合并
5 天 6 小时
30 天内合并 PR
82

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

LabsCrypt/flowfi 的其他 Issue

查看 LabsCrypt/flowfi 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。