Skip to content

fix(escrow): harden internal.rs and complete multi-asset/refund flows - #789

Merged
JSE19 merged 4 commits into
JSE-ORG:mainfrom
Asta-wizard:feat/716-717-729-730-escrow-contract-improvements
Aug 27, 2026
Merged

fix(escrow): harden internal.rs and complete multi-asset/refund flows#789
JSE19 merged 4 commits into
JSE-ORG:mainfrom
Asta-wizard:feat/716-717-729-730-escrow-contract-improvements

Conversation

@Asta-wizard

Copy link
Copy Markdown
Contributor

Summary

Four escrow contract issues in one batch (Stellar Wave):

Motivation

Each issue describes a correctness gap or dead code in the escrow lifecycle; acceptance criteria were verified against the current code before implementing.

Changes

Test Coverage

Notes for Reviewers

  • Test snapshots in contracts/escrow/test_snapshots/ were not touched: they are stale relative to main and regenerated automatically by the Soroban test harness on every cargo test run (unrelated to this change).
  • No ABI-breaking changes: the mutating public surface (create_escrow, request_refund, approve_refund, mark_shipped) is unchanged; only an internal helper's signature changed.

Closes #716
Closes #717
Closes #729
Closes #730

The tally_votes function used saturating_add for vote counting, which
silently caps at u32::MAX when overflow would occur. Replaced with
checked_add that returns ArithmeticError on overflow, matching the
rest of the codebase's financial math pattern.

closes JSE-ORG#716
transition_state was annotated #[allow(dead_code)] and never called by
any production code; the real state guards are enforced inline. Removed
the dead function, its #[allow(dead_code)], and the test_escrow_states
module that only exercised it.

closes JSE-ORG#717
Multi-asset support (per-escrow token selection) is already in place for
create_escrow, EscrowData.token, and fund_escrow. Adds a test confirming
the escrow's chosen token is actually enforced: funding with a buyer who
only holds a different token reverts and leaves the escrow untouched.

closes JSE-ORG#729
request_refund/approve_refund already existed for the Funded ->
RefundRequested -> Refunded flow. Completes the third acceptance
criterion: the seller can now mark_shipped from RefundRequested, which
overrides the outstanding refund request and transitions to Shipped
without returning funds. Adds tests covering the override path and
confirming Pending is still rejected.

closes JSE-ORG#730
@drips-wave

drips-wave Bot commented Aug 27, 2026

Copy link
Copy Markdown

@Asta-wizard 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

@JSE19
JSE19 merged commit f73de3c into JSE-ORG:main Aug 27, 2026
5 checks 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

2 participants