Skip to content

Add dispute voting window and quorum requirement to resolve_dispute #58

Description

@meshackyaro

Description

resolve_dispute (contracts/trustflow/src/lib.rs, ~line 427) can be called by anyone, at any time, as soon as DisputeVoters(escrow_id) is non-empty — its only gate is voters.is_empty(). There is no minimum quorum and no voting-window deadline. This means a single juror (including one colluding with whoever raised or is defending the dispute) can vote, and the caller can immediately call resolve_dispute before any other honest juror gets a chance to vote — the "tally" at that point is just that one vote, which trivially wins and settles the escrow.

This defeats the entire purpose of a juror pool: the honesty guarantee assumes disputes are decided by a meaningful sample of jurors, not whoever votes and resolves fastest.

Component

Contract

Difficulty

🔴 Hard

Tasks

  • Add a dispute_deadline (ledger sequence or timestamp) to DisputeRecord, set when raise_dispute is called
  • Add a minimum-quorum requirement (configurable, e.g. via an admin-set DataKey) that resolve_dispute must check alongside the deadline
  • Reject resolve_dispute calls before the deadline has passed or before quorum is met, whichever the design settles on (decide: quorum-OR-deadline vs. quorum-AND-deadline)
  • Handle the case where the deadline passes with fewer than quorum votes cast (e.g. default ruling, or require a higher juror participation incentive)
  • Add contract tests covering: resolve attempted with 1 vote before deadline (should fail), resolve after deadline with sub-quorum votes, resolve after quorum reached before deadline

Acceptance Criteria

  • resolve_dispute reverts if called before the voting window closes and quorum has not been met
  • Existing dispute-round test helpers (dispute_round in the test module) updated to advance the ledger/timestamp past the deadline where needed
  • New tests demonstrate the single-vote early-resolution scenario described above is no longer exploitable
  • No regression in existing slashing/tie-break test suite

Estimated Time

3-4 days

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26bugSomething isn't workingdifficulty: hardHard difficulty issuepriority: highHigh priority issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions