Skip to content

feat(dispute): implement on-chain dispute resolution with arbitration voting (#344) - #1060

Closed
huangji6693-max wants to merge 1 commit into
Stellar-split:mainfrom
huangji6693-max:feat/onchain-dispute-arbitration-voting-344
Closed

huangji6693-max wants to merge 1 commit into
Stellar-split:mainfrom
huangji6693-max:feat/onchain-dispute-arbitration-voting-344

Conversation

@huangji6693-max

Copy link
Copy Markdown

Summary

Implements on-chain dispute resolution with multi-arbitrator quorum voting (open_dispute, vote_dispute, resolve_dispute) for StellarSplit.

Closes #344

Key Changes

  1. Arbitrator Set & Quorum Configuration:
    • set_arbitrators(env, admin, arbitrator_set, quorum_threshold) allows the admin to configure the designated arbitrator set and quorum threshold (e.g. 2-of-3), stored under arbitrator_set_key() (arb_set) and quorum_threshold_key() (arb_quor).
    • Query helpers: get_arbitrator_set(env) and get_quorum_threshold(env).
  2. Dispute Lifecycle Entry Points:
    • open_dispute(env, invoice_id, payer, reason): Opens a dispute on an invoice, freezes the invoice (invoice.disputed = true, blocking release and refund), stores ArbitrationDispute under dispute_key(invoice_id) (("dispute", invoice_id)), and emits DisputeOpened.
    • vote_dispute(env, invoice_id, arbitrator, approve): Verifies the caller is in arbitrator_set, rejects duplicate votes from the same arbitrator, tallies approve_votes / reject_votes, and emits DisputeVoteCast.
    • resolve_dispute(env, invoice_id): Permissionless crank callable by anyone once approve_votes + reject_votes >= quorum_threshold. Resolves according to majority vote (approve_votes > reject_votes releases funds to recipients; reject_votes > approve_votes refunds all payers) and emits DisputeResolved.
  3. Storage Key Snapshot & Migration Note:
    • Added dispute_key, arbitrator_set_key, and quorum_threshold_key to contracts/split/src/storage_snapshot.rs and updated tests/snapshots/storage_keys.json (verified collision-free).
  4. Unit Tests (issue_344_tests):
    • test_dispute_arbitration_open_vote_resolve_approve_path
    • test_dispute_arbitration_open_vote_resolve_reject_path
    • test_dispute_arbitration_duplicate_vote_rejected
    • test_dispute_arbitration_non_arbitrator_vote_rejected
    • test_dispute_arbitration_non_existent_invoice_rejected
    • test_dispute_freezes_refund_while_open

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement on-chain dispute resolution with arbitration voting

2 participants