Skip to content

test: add negative-amount, rate-limit, deactivation, and cancel invariant tests#993

Merged
Wilfred007 merged 1 commit into
Gildado:mainfrom
Williams-1604:feat/escrow-negative-amount-rate-limit-tests
Jun 29, 2026
Merged

test: add negative-amount, rate-limit, deactivation, and cancel invariant tests#993
Wilfred007 merged 1 commit into
Gildado:mainfrom
Williams-1604:feat/escrow-negative-amount-rate-limit-tests

Conversation

@Williams-1604

Copy link
Copy Markdown
Contributor

Summary

Test plan

  • cargo test -p orgusd — all orgusd tests pass (4 new + existing)
  • cargo test -p milestone_escrow — all milestone_escrow tests pass (6 new + existing)

Closes #882
Closes #884
Closes #885
Closes #886

…iant tests

orgusd (Gildado#886):
- test_mint_rejects_negative_amount / test_mint_rejects_large_negative_amount
- test_transfer_rejects_negative_amount / test_transfer_rejects_large_negative_amount
  Explicitly assert that negative (not just zero) amounts are rejected with
  InvalidAmount; documents the amount <= 0 guard intent for future refactors.

milestone_escrow (Gildado#882, Gildado#884, Gildado#885):
- test_approve_two_milestones_same_ledger_fails (Gildado#884)
  Confirms per-escrow LastApproveLedger throttle blocks a second approve for a
  *different* milestone in the same ledger.
- test_release_two_milestones_same_ledger_fails (Gildado#884)
  Same check for release_milestone via LastReleaseLedger.
- test_final_release_deactivates_escrow_when_released_equals_total (Gildado#882)
  Exercises the released_amount >= total_amount → is_active = false code path
  with a 2-milestone escrow to make the transition explicit.
- test_cancel_partial_release_unreleased_amount_is_exact (Gildado#885)
  Asserts cancel_escrow() computes unreleased funds by summing non-released
  milestone amounts (not saturating_sub), so recovered == exact unreleased sum.
- test_cancel_with_approved_milestones_recovers_full_unreleased (Gildado#885)
  Cancellation after approving-but-not-releasing returns full escrow balance.
@drips-wave

drips-wave Bot commented Jun 29, 2026

Copy link
Copy Markdown

@Williams-1604 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

@Wilfred007 Wilfred007 merged commit b567d6e into Gildado:main Jun 29, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment