Fix/invoice escrow due date validation#63
Merged
Jayrodri088 merged 2 commits intoStellarState:mainfrom Mar 28, 2026
Merged
Conversation
- Add validation in approve function to reject amount < 0 - Reuse existing Error::InvalidAmount variant - Add comprehensive unit tests for negative amount rejection - Tests cover: negative amount rejection, zero amount acceptance, invalid expiration rejection Closes StellarState#28
- Add validation in create_escrow to reject due_date <= current timestamp - Add validation to reject due_date = 0 - Add new Error::InvalidDueDate variant - Add comprehensive unit tests for due_date validation - Tests cover: past date rejection, equal timestamp rejection, zero rejection, future acceptance - Update docs/API.md with due_date constraints Closes StellarState#14
|
@Emmy123222 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
create_escrow
accepted past due dates, making escrows immediately refundable after funding - a security footgun.
Solution
Added validation to reject due_date <= current_timestamp and due_date = 0.
Changes
Added Error::InvalidDueDate variant
Enhanced
create_escrow
with due_date validation
Added 4 comprehensive unit tests
Updated API documentation
Impact
Prevents immediate refundability of newly funded escrows, ensuring proper invoice financing lifecycle.
Close #14