feat(escrow): enforce dispute state transitions and cover dispute edge cases (#220) - #230
Merged
SudiptaPaul-31 merged 1 commit intoSep 27, 2026
Conversation
|
@Tinu-ola 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.
Overview
Hardens the Soroban dispute escrow mechanism in
contracts/contracts/escrowso the dispute lifecycle matches the state machine required by the issue:Submitted -> Disputed -> Resolved -> Released/Refunded.The escrow contract already exposed
dispute()/resolve_dispute()and theDisputeRaised/DisputeResolvedevents. This PR closes the remaining gaps between that implementation and the issue's acceptance criteria, and adds the edge-case tests the issue explicitly asks for.Related Issue
Closes #220
Changes
contracts/contracts/escrow/src/lib.rsdispute()Unauthorized(404 Not Found Page #7).Submitted/Approved). Disputing aPending/Fundedmilestone now returnsInvalidMilestoneStatus(Design logo for the website #6), so a dispute can no longer skip milestone submission.release()Disputedguard returningInvalidMilestoneStatus(Design logo for the website #6). Escrowed funds are frozen while a dispute is open andrelease()is blocked until the arbitrator resolves it.contracts/contracts/escrow/src/test.rsAdded an edge-case suite for the dispute mechanism:
test_dispute_without_funding_fails- dispute cannot bypass escrow funding.test_dispute_before_submission_fails- dispute cannot bypass milestone submission.test_arbiter_can_raise_dispute- the arbitrator is an authorized disputer.test_release_blocked_while_disputed- payments are frozen during a dispute.test_refund_blocked_while_disputed- refunds are frozen during a dispute.test_multiple_disputes_rejected- a resolved milestone is terminal.test_resolve_without_dispute_fails- resolution requires an open dispute.test_dispute_events_are_emitted-DisputeRaised/DisputeResolvedare emitted.Verification
InvalidMilestoneStatus= Design logo for the website #6).test_dispute_and_resolve_to_freelancer,test_dispute_and_resolve_to_client,test_dispute_clears_approvals,test_unauthorized_dispute_fails,test_dispute_after_release_fails) still hold under the new guards - they dispute milestones inSubmitted/Approvedstate.cargo test --workspace(contracts CI job) was not executed here. The new tests follow the existing#[should_panic(expected = "HostError: Error(Contract, #N)")]and event-count conventions already used intest.rs.