Repository navigation
feat(dispute): implement on-chain dispute resolution with arbitration voting (#344) - #1060
Closed
huangji6693-max wants to merge 1 commit into
Closed
huangji6693-max wants to merge 1 commit into
huangji6693-max wants to merge 1 commit into
Conversation
7 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.
Summary
Implements on-chain dispute resolution with multi-arbitrator quorum voting (
open_dispute,vote_dispute,resolve_dispute) for StellarSplit.Closes #344
Key Changes
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 underarbitrator_set_key()(arb_set) andquorum_threshold_key()(arb_quor).get_arbitrator_set(env)andget_quorum_threshold(env).open_dispute(env, invoice_id, payer, reason): Opens a dispute on an invoice, freezes the invoice (invoice.disputed = true, blockingreleaseandrefund), storesArbitrationDisputeunderdispute_key(invoice_id)(("dispute", invoice_id)), and emitsDisputeOpened.vote_dispute(env, invoice_id, arbitrator, approve): Verifies the caller is inarbitrator_set, rejects duplicate votes from the same arbitrator, talliesapprove_votes/reject_votes, and emitsDisputeVoteCast.resolve_dispute(env, invoice_id): Permissionless crank callable by anyone onceapprove_votes + reject_votes >= quorum_threshold. Resolves according to majority vote (approve_votes > reject_votesreleases funds to recipients;reject_votes > approve_votesrefunds all payers) and emitsDisputeResolved.dispute_key,arbitrator_set_key, andquorum_threshold_keytocontracts/split/src/storage_snapshot.rsand updatedtests/snapshots/storage_keys.json(verified collision-free).issue_344_tests):test_dispute_arbitration_open_vote_resolve_approve_pathtest_dispute_arbitration_open_vote_resolve_reject_pathtest_dispute_arbitration_duplicate_vote_rejectedtest_dispute_arbitration_non_arbitrator_vote_rejectedtest_dispute_arbitration_non_existent_invoice_rejectedtest_dispute_freezes_refund_while_open