Skip to content

Fix/invoice escrow due date validation#63

Merged
Jayrodri088 merged 2 commits intoStellarState:mainfrom
Emmy123222:fix/invoice-escrow-due-date-validation
Mar 28, 2026
Merged

Fix/invoice escrow due date validation#63
Jayrodri088 merged 2 commits intoStellarState:mainfrom
Emmy123222:fix/invoice-escrow-due-date-validation

Conversation

@Emmy123222
Copy link
Copy Markdown
Contributor

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

- 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
@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 28, 2026

@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! 🚀

Learn more about application limits

@Jayrodri088 Jayrodri088 merged commit fd9c3f0 into StellarState:main Mar 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] invoice-escrow due_date lacks validation

2 participants