Skip to content

BountiesService.expireOverdue marks FUNDED bounties EXPIRED without refunding the escrow, stranding the sponsor's locked funds #794

Closed

Description

@chonilius

expireOverdue flips the status and nothing else (src/bounties/bounties.service.ts:278-298):

      .andWhere('bounty.status IN (:...statuses)', {
        statuses: [BountyStatus.OPEN, BountyStatus.FUNDED, BountyStatus.CLAIMED],
      })
...
    for (const bounty of overdue) {
      bounty.status = BountyStatus.EXPIRED;
      await this.bountyRepo.save(bounty);
    }

FUNDED and CLAIMED bounties have a LOCKED escrow holding real funds. Nothing calls escrowService.refund.

Why it matters: the money stays locked on-chain indefinitely. The bounty is now EXPIRED, and BOUNTY_TRANSITIONS permits EXPIRED → REFUNDED, so a refund is still possible — but only if the sponsor notices and explicitly asks, and nothing tells them. There is no notification, no dashboard surface for expired-but-funded bounties, and no job. The on-chain contract's own permissionless refund opens only after deadline + GRACE_PERIOD (14 days) and pays the funder, so funds are eventually recoverable by a third party calling the contract directly — which is not a flow this product exposes.

The scheduler's comment acknowledges the gap and defers it: "This is deliberately independent of (and runs prior to) any on-chain auto-refund follow-up for expired FUNDED bounties (#26)." The local flip shipped; the follow-up did not, so expiry currently converts a live bounty into stranded funds.

Fix: after the status flip, call escrowService.refund(bounty.escrowId) for bounties that had one, inside the same sweep, and transition to REFUNDED on success / EXPIRED on failure. Batch the status writes into one UPDATE instead of a save per row while there.

Activity

  1. added
    bug
    on Nov 12, 2026
  2. added
    Stellar Wave
    on Nov 19, 2026
  3. Divine639700 commented on Nov 19, 2026

    @Divine639700

    @Divine639700 has applied to work on this issue as part of the Stellar Wave Program's 11th wave.

    Hi maintainer, I’d like to fix expireOverdue so funded and claimed bounties don’t leave their escrow funds locked after expiration. I’ll integrate the refund operation into the expiry process, transition bounties to REFUNDED only after successful refunds, preserve EXPIRED when refunds fail, and add tests covering both outcomes.

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @Divine639700 to this issue.

  4. jd-here-007 commented on Nov 19, 2026

    @jd-here-007
    Contributor

    @jd-here-007 has applied to work on this issue as part of the Stellar Wave Program's 11th wave.

    hi maintainer let me fix this please

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @jd-here-007 to this issue.

  5. drips-wave commented on Nov 19, 2026

    @drips-wave

    Congratulations, @jd-here-007! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on November 25, 2026.

    🧑‍💻 @jd-here-007: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

    Warning

    When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

    🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

    🌊 Happy Wave 🌊

  6. drips-wave commented on Nov 20, 2026

    @drips-wave

    This issue has been completed by @jd-here-007 as part of the Stellar Wave Program's 11th Wave 🥳

    😎 @jd-here-007: You earned 200 Points for completing this issue! Once the Wave's rewards are finalized, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.

    🧑‍💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Stellar Wavebug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions