flowfi icon indicating copy to clipboard operation
flowfi copied to clipboard

[Contracts] Test cancel_stream on a fully accrued but never-withdrawn stream

Open K1NGD4VID opened this issue 2 months ago • 8 comments

Labels: contracts, testing, smart-contract, soroban, third-wave-audit File/location: contracts/stream_contract/src/lib.rs:515-571 (cancel_stream)

Description: No test covers cancelling a stream after its full duration has elapsed but before any withdraw() call. calculate_claimable caps at the full deposited_amount, so cancel_stream should pay 100% of the deposit to the recipient with a zero refund to the sender, yet the resulting status is Cancelled rather than Completed (only apply_withdrawal ever sets Completed) and this distinction is never asserted.

Acceptance Criteria:

  • [ ] Create a stream, advance the ledger past its full duration without calling withdraw, then call cancel_stream
  • [ ] Assert the recipient receives the entire deposited_amount and the sender receives a 0 refund
  • [ ] Assert the resulting stream.status is StreamStatus::Cancelled, not Completed

Notes: Related to but distinct from test_cancel_stream_refunds_sender (partial accrual) and test_withdraw_full_balance (Completed via withdraw); this is the missing intersection of 'fully accrued' + 'cancel path' + 'status field correctness'.

K1NGD4VID avatar Sep 27 '26 21:09 K1NGD4VID

Hi maintainers,

I reviewed this issue and would like to contribute the fix.

Technical outline:

  1. Audit storage layout and state invariants ensuring strict auth guards.
  2. Implement deterministic state transitions with safe checked arithmetic.
  3. Add hermetic unit and regression tests covering authorized, unauthorized, and boundary edge cases.
  4. Profile instruction and CPU/gas limits under Soroban host environment.

Could you please assign this issue to me? Looking forward to delivering a clean PR.

Ranjeet2063 avatar Oct 04 '26 19:10 Ranjeet2063

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

Hi maintainer, I can fix this kindly assign

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

Teejay2696 avatar Oct 18 '26 02:10 Teejay2696

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

Hi Maintainer, I can fix this pls assign. ETA 5hrs

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

CollinsKRO avatar Oct 18 '26 02:10 CollinsKRO

@anifast-123 has applied to work on this issue as part of the Stellar Wave Program's 10th wave.

Hello maintainer, i would like to work on this issue

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

anifast-123 avatar Oct 18 '26 02:10 anifast-123

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

Hi Maintainer, I’d like to work on this issue. I have experience handling similar tasks and can start immediately.

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

aduagba4133 avatar Oct 18 '26 02:10 aduagba4133

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

Hello Maintainer, I’ve gone through the issue carefully and understand the requirements. I’m confident I can handle the task and deliver a solution that meets the expected criteria. I’d appreciate it if you could assign the issue to me.

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

Tamziycode avatar Oct 18 '26 02:10 Tamziycode

Congratulations, @anifast-123! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on October 22, 2026.

🧑‍💻 @anifast-123: 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 Oct 18 '26 02:10 drips-wave[bot]

This issue has been completed by @anifast-123 as part of the Stellar Wave Program's 10th Wave 🥳

😎 @anifast-123: 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 Oct 18 '26 02:10 drips-wave[bot]