[Contracts] Use the checked end-time helper in resume_stream
Overview & Background
resume_stream computes the linear end time as now + (remaining / stream.rate_per_second) as u64 — the exact panicking pattern project_end_time was written to eliminate. That helper's doc explicitly says: "The plain now + (remaining / rate) as u64 this replaces silently truncated the quotient and then panicked on the addition under overflow-checks, aborting an otherwise valid top-up or resume." The workspace sets overflow-checks = true, and resume_stream's own doc promises ArithmeticOverflow — but the unchecked path traps instead. modify_rate/top_up_stream already use the checked helper.
Technical Specification & Architecture
- Replace
contracts/stream_contract/src/lib.rs:2412withSelf::project_end_time(now, remaining, stream.rate_per_second)?. - Add a resume test with values that would overflow the unchecked add, asserting
ArithmeticOverflowis returned (not a panic).
Target Files
contracts/stream_contract/src/lib.rscontracts/stream_contract/src/test.rs
Acceptance Criteria
- [ ]
resume_streamusesproject_end_timefor all vesting modes. - [ ] Overflowing inputs return
ArithmeticOverflowinstead of panicking. - [ ] A regression test locks the behavior.
@Kami-no-san has applied to work on this issue as part of the Stellar Wave Program's 11th wave.
Hi Maintainer,
I’d like to take this on. I will replace the unchecked end-time calculation in
resume_stream(contracts/stream_contract/src/lib.rs) withSelf::project_end_time(now, remaining, stream.rate_per_second)?across vesting modes, and add a regression test incontracts/stream_contract/src/test.rsverifying that overflowing inputs returnArithmeticOverflowinstead of panicking.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @Kami-no-san to this issue.
@abrcrmb has applied to work on this issue as part of the Stellar Wave Program's 11th wave.
please assign to me
ℹ️ Repo Maintainers: To accept this application, review their application or assign @abrcrmb to this issue.
Congratulations, @abrcrmb! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on November 25, 2026.
🧑💻 @abrcrmb: 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 @abrcrmb as part of the Stellar Wave Program's 11th Wave 🥳
😎 @abrcrmb: 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.