[Contracts] Add unit tests verifying behavior when stream end_time equals start_time
Overview
Edge case validation: What happens if a caller attempts to create a stream where start_time == end_time or duration == 0?
Problem
- Division by zero in rate calculation or instant 100% vesting behavior must be strictly asserted to prevent contract panics.
Proposed Changes
- In
contracts/stream_contract/src/test.rs, add test cases for:start_time == end_time: Verify it reverts withStreamError::InvalidTimeRange.start_time > end_time: Verify revert.
- Ensure duration is validated as
end_time > start_timebefore rate arithmetic.
Acceptance Criteria
- [ ] Stream creation with zero duration strictly reverts.
- [ ] Clear error code returned without host panic.
- [ ] Tests pass in
cargo test.
@Oluwasuyi-Oluwatimilehin-Daniel has applied to work on this issue as part of the Stellar Wave Program's 9th wave.
Hello @maintainer, I’d like to work on this issue. I have experience handling similar tasks and can start immediately. And I will deliver at the shortest possible time.
ℹ️ Repo Maintainers: To accept this application, review their application or assign @Oluwasuyi-Oluwatimilehin-Daniel to this issue.
Congratulations, @Oluwasuyi-Oluwatimilehin-Daniel! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on September 30, 2026.
🧑💻 @Oluwasuyi-Oluwatimilehin-Daniel: 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 marked as completed by a Drips Wave moderator for @timiturn3r as part of the Stellar Wave Program's 9th Wave 🥳
Moderator's reason: [Auto-assessed] The PR has been merged (mergedAt: 2026-10-08T06:08:40Z), and the changes directly implement unit tests and error definitions covering start_time equal to or greater than end_time as requested in issue #1518.
😎 @timiturn3r: 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.
🧑💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.
ℹ️ Note: This issue was marked complete via moderation. Points were issued even though the GitHub issue remains open.