flowfi icon indicating copy to clipboard operation
flowfi copied to clipboard

[Contracts] Test cancel_stream/withdraw when sender equals recipient

Open K1NGD4VID opened this issue 2 months ago • 7 comments

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

Description: test_create_stream_self_stream only checks that creating a stream with sender == recipient persists correctly. No test exercises withdraw or cancel_stream on a self-stream, where cancel_stream issues two separate token transfers (accrued_amount and refunded_amount) to the same address and withdraw pays the same address that funded the stream.

Acceptance Criteria:

  • [ ] Create a stream with sender == recipient, advance time partially, and call withdraw; assert the claimed amount is credited once to the shared address with no double-count
  • [ ] Create a second self-stream, advance time partially, and call cancel_stream; assert the address's balance increases by exactly accrued_amount + refunded_amount (both transfers land correctly)

Notes: Low severity but a previously untested code path combination; verifies the two-transfer sequence in cancel_stream (lib.rs:550-556) doesn't lose or duplicate funds when both transfers target the same Address.

K1NGD4VID avatar Sep 27 '26 21:09 K1NGD4VID

Greetings,

I would like to work on this issue.

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.

Let me know if this aligns with the repository guidelines and assign when convenient.

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

@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

@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

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]