add test for resolving dispute refund when buyer is not set#192
Merged
JSE19 merged 1 commit intoJun 1, 2026
Merged
Conversation
|
@Elizabeth-dev270 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.
closes #151
PR: Fix [BUG-006] resolve_dispute RefundToBuyer panic (regression test)
Summary
Nonebuyer and trap the contract (panic), leaving escrows permanently Disputed.EscrowHasNoBuyerinstead of trapping.What changed
contracts/escrow/src/test_resolve_dispute_no_buyer.rsEscrowDatawithbuyer: Noneandstate: Disputedand an activeDisputeDataentry.resolve_dispute(..., ResolutionType::Refund)as the admin and assertsEscrowHasNoBuyeris returned (no trap).Why
escrow.buyerwasNone(open-buyer escrows or accidentalNone). That panics the WASM host and permanently freezes funds. The test prevents regressions and confirms code paths handlingNonebehave as expected (return a typed error rather than trap).Files touched
contracts/escrow/src/test_resolve_dispute_no_buyer.rsTesting
Recommended follow-ups (suggested fixes)
buyer: Addressnon-optional inEscrowDataand require a buyer atcreate_escrowtime. This eliminates theNonepath but is a breaking storage/API change and requires migration.buyer: Option<Address>but harden all flows that assume a buyer exists:EscrowHasNoBuyer(or another clear error) anywhere a buyer is required (already done in several places). Ensure no.unwrap()or unchecked clones remain forbuyer.Notes
Next steps
resolve_dispute/payout paths to return a clear error without panicking) and add corresponding tests, then open a PR with the code fix and this test included.