[Backend] Stop persisting financial state from placeholder simulated- transactions
Overview & Background
Pause, resume, and withdraw currently return hard-coded placeholder hashes (txHash: 'simulated-pause-' + streamId etc.) from simulation-only calls that never land on-chain — yet the withdraw route unconditionally mutates financial state: it increments withdrawnAmount, may flip isActive to false, and writes a WITHDRAWN StreamEvent keyed by the fake hash. Pause returns success: true while isPaused is never touched. Because every withdrawal of the same stream reuses the same placeholder hash, the upsert's update: {} silently swallows the 2nd+ WITHDRAWN events. Claimable balances and stream status become wrong.
Technical Specification & Architecture
- Simulation stubs must not mutate accounting:
backend/src/services/sorobanService.ts:524(simulated-pause-),:557(simulated-resume-),:589(simulated-withdraw-) runsimulateContractCalland return a mock hash.backend/src/routes/v1/streams/withdraw.ts:104-133performs theUPDATE "Stream" SET "withdrawnAmount" ...regardless;:136-153writes the event withtransactionHash: result.txHash.
- Choose one authoritative writer: let the indexer own
withdrawnAmount/events from real on-chain events, or gate the stubs behind an explicit sandbox flag with asimulated: trueresponse and zero DB writes. - Fix the pause docstring lie in
backend/src/controllers/stream.controller.ts:736-738(claims "updates the database") and return honest state (isPausedunchanged) or implement the state change.
Target Files
backend/src/services/sorobanService.tsbackend/src/routes/v1/streams/withdraw.tsbackend/src/controllers/stream.controller.ts
Acceptance Criteria
- [ ] Simulated/sandbox calls never write
withdrawnAmount,isActive, or StreamEvent rows. - [ ] API responses from simulations are explicitly marked
simulated: trueand carry no fake tx hash presented as real. - [ ] Event upserts use real submitted tx hashes (unique per transaction).
- [ ] Tests cover: repeated withdraw attempts cannot double-count; pause reflects true state.
@DammyAji has applied to work on this issue as part of the Stellar Wave Program's 11th wave.
Hello maintainer. I'd like to work on this issue please. I'd be sure to implement changes as described. Thank you.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @DammyAji to this issue.
@OlamideAdesina has applied to work on this issue as part of the Stellar Wave Program's 11th wave.
Hi maintainer, I can get this issue fixed quickly. Please assign it to me
ℹ️ Repo Maintainers: To accept this application, review their application or assign @OlamideAdesina to this issue.
Congratulations, @OlamideAdesina! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on November 25, 2026.
🧑💻 @OlamideAdesina: 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 🌊
This issue has been completed by @OlamideAdesina as part of the Stellar Wave Program's 11th Wave 🥳
😎 @OlamideAdesina: 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.