MaintenancePoolService.assignReward reports a stale balance in its 'exceeds pool balance' error
Maintainers usually reply within 1 day
@urielit1313-creator is already working on this.
Since Oct 13, 2026.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 22/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- typescript
- Domain
- backend
Research direction
Start in MaintenancePoolService.assignReward, at the error thrown when the conditional UPDATE ... WHERE balance >= :amount affects zero rows, and check where pool.balance was read before that update. Fix the message so it does not show a stale balance, either by re-reading the balance or using RETURNING, or by dropping the figure. Two open pull requests (#624 and #650) already target this issue, so compare them before writing a new patch. Done means the error reports a current or omitted balance under concurrent updates, with related issue #274 in mind.
Written by the indexing model from the issue text.
Description
Problem
When the conditional UPDATE … WHERE balance >= :amount affects 0 rows, the error is Requested reward ${amount} exceeds pool balance ${pool.balance}. pool was read before the update, and under concurrency (exactly the case this guard exists for, #274) the balance shown can be higher than the real one. The message then says something like "exceeds pool balance 500" for a 300 reward.
Suggested fix
Re-read the balance (or RETURNING balance) for the message, or omit the figure.
Related: #274
- Dominant language
- TypeScript
- Stars
- 2
- Forks
- 90
- Avg merge
- 31m
- Merged PRs (30d)
- 20
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from MergeFi/backend
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
bug security
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
bug testing
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
bug security
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
zapcooking/frontend#946 ·
Maintainers usually reply within 1 day
-
enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
WiliamRosa/cosmos-semantic-platform#40 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
liberation-data/drivine#733 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
makecindy/cindy#10062 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day