feat: Decentralized Dispute Escrow Splitting with Multi-Sig Arbitration (#76) - #95
Merged
bakarezainab merged 1 commit intoAug 20, 2026
Conversation
…itration Implement LatterFixxx#76 — allow arbitrators to split escrowed dispute funds among multiple recipients according to negotiated percentage shares, with multi-sig threshold verification for execution. Changes: - Add DisputeSplitRecipient and DisputeSplit types for fractional splits - Add resolve_dispute_split entry point supporting N-recipient splits via basis-point shares (must sum to 10000 = 100%) - Platform fee is deducted from total before proportional distribution - Add ResolveDisputeSplit variant to MultisigAction for threshold-gated arbitration — requires configured number of signer approvals before execution - Add emit_dispute_split_resolved event for off-chain indexing - Validate split invariants: non-empty recipients, matching lengths, shares sum to 10000 bps, task must be in Disputed status Tests: - test_dispute_split_three_way: 3 recipients, 40/30/30 split with 10% fee - test_dispute_split_zero_fee: 3 recipients, 25/25/50 with 0% fee - test_dispute_split_rejects_non_disputed: rejects on non-disputed task - test_dispute_split_rejects_invalid_shares: rejects when shares != 10000 - test_dispute_split_rejects_mismatched_lengths: rejects length mismatch - test_dispute_split_via_multisig_proposal: end-to-end multisig 2-of-3 approval triggering auto-executed split resolution
3 tasks
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 #85
Summary
Implements #76 — adds support for splitting escrowed dispute funds among multiple recipients according to negotiated percentage shares, gated by multi-sig arbitrator threshold signatures.
What was implemented
1. Fractional Split Parameters in Dispute Resolution
Added a new
resolve_dispute_splitentry point that accepts:task_id— must be inDisputedstatusrecipients: Vec<Address>— non-empty list of payment recipients (creator, assignee, mediator, third parties, etc.)shares_bps: Vec<u32>— basis-point share per recipient (must sum to exactly 10000 = 100%)Key invariant:
recipients.len() == shares_bps.len()andsum(shares_bps) == 10000.Fee handling: Platform fee is deducted from the total escrowed reward before proportional distribution. Each recipient receives
(total - fee) * share_bps / 10000. The fee is transferred atomically to thefee_recipient. Integer truncation ensures the contract never over-pays.Example with 1000 tokens, 10% fee, 40/30/30 split:
2. Multi-Sig Arbitrator Execution Handler
Extended
MultisigActionwith a new variant:This allows arbitrator committees (configured via
configure_multisig) to propose and vote on dispute resolutions. When the threshold number of signer approvals is reached, the split is executed atomically viaapply_action.3. Atomic Distribution with Correct Fees
All transfers happen in a single transaction:
fee_recipientResolveddisp_spltevent emitted for off-chain indexingFiles changed
src/lib.rsDisputeSplitRecipient,DisputeSplittypes;resolve_dispute_splitcontract method and module-level functionsrc/multisig.rsResolveDisputeSplitvariant toMultisigAction; validation and execution inapply_actionsrc/events.rsemit_dispute_split_resolvedeventsrc/test.rsTests
test_dispute_split_three_waytest_dispute_split_zero_feetest_dispute_split_rejects_non_disputedtest_dispute_split_rejects_invalid_sharestest_dispute_split_rejects_mismatched_lengthstest_dispute_split_via_multisig_proposalAll 84 tests pass. No warnings.
Acceptance Criteria