flowfi icon indicating copy to clipboard operation
flowfi copied to clipboard

[Contracts] resume_stream lacks an is_active/status guard - a cancelled-while-paused stream can be resumed back to Active

Open grantfox-oss[bot] opened this issue 5 months ago • 14 comments

Telegram (ask questions / claim the issue here first): https://t.me/+DOylgFv1jyJlNzM0

Labels: bug, contracts, Stellar Wave, rust

A stream that was cancelled while paused can be resumed back to Active, leaving an inconsistent record.

cancel_stream (lib.rs:515-518) sets is_active=false and status=Cancelled but never clears paused or paused_at. resume_stream (lib.rs:591) only checks if !stream.paused and never calls validate_stream_active. So if a stream was paused (paused=true) and then cancelled, it still passes the resume check: status flips back to Active (lib.rs:613) while is_active stays false. That's a contradictory record, plus a phantom stream_resumed event with a bogus new_end_time that indexers read as a reactivation.

What the fix has to hold to

  • resume_stream rejects any non-active stream
  • Cancelling settles the pause flags so no stale paused state lingers

Done when

  • [ ] resume_stream rejects non-active streams (call validate_stream_active or require status==Paused), returning StreamInactive
  • [ ] cancel_stream clears paused/paused_at when settling
  • [ ] Test: pause, then cancel, then resume_stream returns StreamInactive and emits no stream_resumed event
  • [ ] Tests + fmt pass, CI green

Where to start All in contracts/stream_contract/src/lib.rs. Indexer/event-worker changes are out of scope. Small guard plus a state-cleanup line.

grantfox-oss[bot] avatar Jun 27 '26 19:06 grantfox-oss[bot]

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

pls assign me

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

Abdulrasaq1515 avatar Jun 29 '26 21:06 Abdulrasaq1515

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

Hi maintainer, I have read and understood the issue requirements and checked the necessary documentation. I’m confident I can work on this task effectively and deliver a proper solution.

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

Killerjunior avatar Jun 29 '26 22:06 Killerjunior

@Gogo-Eng has applied to work on this issue as part of the Stellar Wave Program's 6th wave.

i will love to work on this issue

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

Gogo-Eng avatar Jun 29 '26 23:06 Gogo-Eng

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

I would love to work on this issue

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

iyanumajekodunmi756 avatar Jun 30 '26 01:06 iyanumajekodunmi756

@Frontman-Code has applied to work on this issue as part of the Stellar Wave Program's 6th wave.

I will love to work on this issue

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

Frontman-Code avatar Jun 30 '26 01:06 Frontman-Code

@Anthony-19 has applied to work on this issue as part of the Stellar Wave Program's 6th wave.

Hi Maintainer, I would love to jump on this

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

Anthony-19 avatar Jun 30 '26 01:06 Anthony-19

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

Hi Maintainer, haven reviewed the description of the issue, and well experienced with Js Library, I would like to hop on the issue and sure to deliver at ETA 2hrs

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

AbuJulaybeeb avatar Jun 30 '26 01:06 AbuJulaybeeb

@deep-bhikadiya has applied to work on this issue as part of the Stellar Wave Program's 6th wave.

Hello, this looks like something I can help with. I’ll work on the PR today and share it once it’s ready.

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

deep-bhikadiya avatar Jun 30 '26 01:06 deep-bhikadiya

Congratulations, @Anthony-19! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on June 30, 2026.

🧑‍💻 @Anthony-19: 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 🌊

drips-wave[bot] avatar Jun 30 '26 01:06 drips-wave[bot]

🦊 GrantFox — @Anthony-19 has been assigned to this issue!

Next steps:

  1. Open a Pull Request referencing this issue (e.g., Closes #787)
  2. Your PR will be reviewed by the LabsCrypt maintainers

Good luck! Track your progress on GrantFox.

grantfox-oss[bot] avatar Jun 30 '26 01:06 grantfox-oss[bot]

This issue has been removed from the Stellar Wave Program by the repository maintainers.

@Anthony-19, you have been unassigned from this issue. If you have any questions, please reach out to the repo maintainers.

drips-wave[bot] avatar Nov 18 '26 18:11 drips-wave[bot]

@e-simileoluwa 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 @e-simileoluwa to this issue.

e-simileoluwa avatar Nov 21 '26 12:11 e-simileoluwa

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

🧑‍💻 @e-simileoluwa: 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 🌊

drips-wave[bot] avatar Nov 21 '26 12:11 drips-wave[bot]

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

😎 @e-simileoluwa: 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.

drips-wave[bot] avatar Nov 22 '26 15:11 drips-wave[bot]