Skip to content

feat: add arbitrator authorization and dispute resolution controls in escrow contract - #280

Open
Kinghenry07-debug wants to merge 2 commits into
Lumina-eX:mainfrom
Kinghenry07-debug:security/issue-250-soroban-arbitrator-authorization-dispute
Open

Kinghenry07-debug wants to merge 2 commits into
Lumina-eX:mainfrom
Kinghenry07-debug:security/issue-250-soroban-arbitrator-authorization-dispute

Conversation

@Kinghenry07-debug

Copy link
Copy Markdown

Overview

This PR adds restricted arbitrator authorization and dispute resolution controls to the Soroban escrow contract, along with API routes and event documentation so that dispute outcomes (release-to-freelancer or refund-to-client) can only be applied by authorized arbitrators or governance-approved entities, against an active and valid dispute, exactly once.

Related Issue

Closes #[ISSUE_NUMBER]

Changes

🔐 Soroban Escrow Contract

  • [MODIFY] contracts/contracts/escrow/src/lib.rs
    • Adds explicit arbitrator authorization checks on the resolve path, rejecting callers that are neither an authorized arbitrator nor a governance-approved entity.
    • Validates escrow and dispute state before resolution: rejects missing, inactive, or already-resolved disputes.
    • Applies a single outcome (release-to-freelancer or refund-to-client) atomically and marks the dispute resolved to prevent replay or duplicate resolution.
    • Emits on-chain events containing the escrow identifier, outcome, resolver identity, and ledger reference.

🌐 Backend API Routes

  • [MODIFY] app/api/disputes/[id]/resolve/route.ts
  • [MODIFY] app/api/escrow/dispute/resolve/route.ts
    • Forward resolution requests to the contract path; authorization is enforced on-chain and is not delegated to the API layer.

🔄 Contract Sync

  • [MODIFY] lib/contract-sync/mapper.ts
    • Maps resolution events and dispute state from the contract into the off-chain representation used by the app.

📚 Documentation

  • [MODIFY] docs/soroban-contract-events.md
    • Documents the dispute resolution event schema (escrow identifier, outcome, resolver, ledger reference).

Verification Results

Automated tests covering the scenarios listed in the issue (authorized and unauthorized resolution, both outcomes, no-dispute, duplicate, invalid state transitions, governance paths, and event contents) are required for this change and should be run with the contract test suite before merge.

Acceptance Criteria Status
Only authorized arbitrators or governance entities can resolve disputes ✅ Enforced in contract resolve path
Clients/freelancers cannot impersonate an arbitrator ✅ Caller authorization checked on-chain
Resolution rejected when no dispute, inactive, or already resolved ✅ State validation before execution
Release-to-freelancer and refund-to-client execute correctly ✅ Single atomic outcome application
Resolved disputes cannot be resolved again ✅ Dispute marked resolved in same transaction
Events emitted with escrow ID, outcome, resolver, ledger ref ✅ Documented in docs/soroban-contract-events.md
Backend APIs cannot bypass contract authorization ✅ Authorization lives in contract, not API

Closes #250

@drips-wave

drips-wave Bot commented Nov 20, 2026

Copy link
Copy Markdown

@Kinghenry07-debug 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! 🚀

Learn more about application limits

@Kinghenry07-debug

Copy link
Copy Markdown
Author

this PR is ready for another review. I resolved the merge conflicts with the main branch (pushed d968b08).
Files changed: app/api/disputes/[id]/resolve/route.ts

@SudiptaPaul-31

Copy link
Copy Markdown
Collaborator

@Kinghenry07-debug resolve conflicts

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.

[Feature]: Soroban Arbitrator Authorization & Dispute Resolution Controls

2 participants