Repository navigation
fix(bounties): atomic payouts, no merged refunds, expiry refunds, cheaper sign-in - #884
Merged
chonilius merged 4 commits intoNov 20, 2026
Conversation
|
@jd-here-007 is attempting to deploy a commit to the chonilius' projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@jd-here-007 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
MERGED -> REFUNDEDis removed from the bounty state machine. A merged bounty can no longer be refunded to the sponsor. A stuck merge goes throughRELEASE_FAILEDand is retried.markMergedAndReleaseandrefundnow run the on-chain call and the bounty status write in one database transaction.EscrowService.release,splitReleaseandrefundaccept an optionalEntityManager. If the commit fails after an on-chain release succeeded, the transaction hash is stored on the escrow for reconciliation and the bounty staysMERGED.expireOverduestill flips candidates toEXPIREDin oneUPDATE. It then refunds the escrow of everyEXPIREDbounty whose escrow isLOCKED, each in its own transaction. Failed refunds stayEXPIREDand are retried on the next sweep.upsertFromGithubno longer runs a username lookup before inserting. The insert is attempted with the preferred login, and on a unique violation onusernameit retries with a short random suffix. The 100-candidate loop is removed.Why
Each item matches its issue: a merged bounty could be refunded, the chain and the local ledger could diverge on payout or refund, expired funded bounties stranded their escrow, and new sign-ins paid up to 101 queries for one username.
How to verify by reading
bounty-state-machine.ts:MERGEDlists onlyPAIDandRELEASE_FAILED.bounties.service.ts:markMergedAndReleaseandrefundeach run insidebountyRepo.manager.transactionand passmanagerto the escrow service.escrow.service.ts:release,splitReleaseandrefundtake the optionalmanager.bounties.service.ts:expireOverdueends withrefundStrandedEscrows().users.service.ts:saveNewUserhas no pre-insert lookup, andgenerateUniqueUsernameis removed.Notes
bounty-state-machine.spec.tsassertsMERGED -> REFUNDEDis allowed, so that assertion needs updating.lastFailuremetadata written inside the transaction is rolled back with it. The failure is still raised to the caller.Closes #790
Closes #794
Closes #795
Closes #796