flowfi icon indicating copy to clipboard operation
flowfi copied to clipboard

[Contracts] Add regression test for duplicate stream_ids passed to batch_withdraw

Open blurbeast opened this issue 1 month ago • 5 comments

Overview

When a caller invokes batch_withdraw in contracts/stream_contract/src/lib.rs with a vector containing duplicate stream IDs (e.g. vec![&env, 1, 1]), the second iteration should either withdraw 0 remaining claimable tokens or reject duplicates cleanly without double-counting.

Problem

  • Duplicate stream IDs in a batch call are a critical security edge case that should have an explicit regression test in the test suite.

Proposed Changes

  1. Add test_batch_withdraw_with_duplicate_stream_ids in contracts/stream_contract/src/test.rs.
  2. Assert that passing [stream_id, stream_id] never transfers more than the single stream's vested balance and updates withdrawn_amount accurately.

Acceptance Criteria

  • [ ] Test verifies token contract balance of recipient and contract before and after batch_withdraw.
  • [ ] Confirms no double-withdrawal is possible when duplicate IDs are supplied.
  • [ ] cargo test passes.

blurbeast avatar Oct 18 '26 05:10 blurbeast

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

Hi Maintainer, I've gone through the issue and relevant documentation and identified a potential solution. I'm ready to take responsibility for the implementation and would appreciate the opportunity to contribute to resolving this issue.

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

Yungmon22 avatar Oct 18 '26 12:10 Yungmon22

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

hey gm, i'd love to take on this task

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

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

Assign to me

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

Alosnireda avatar Oct 18 '26 12:10 Alosnireda

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

🧑‍💻 @Alosnireda: 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 12:10 drips-wave[bot]

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

😎 @Alosnireda: 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 18:10 drips-wave[bot]