Skip to content

Add dispute voting window and quorum requirement to resolve_dispute #58

Open

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

  1. added
    bug
    priority: high
    difficulty: hard
    Maybe Rewarded
    GrantFox OSS
    Official Campaign | FWC26
    on Aug 16, 2026
  2. ranjeet150 commented on Sep 13, 2026

    @ranjeet150

    Hi maintainers,

    I would like to resolve this issue. Here is my proposed execution plan:

    • Implementation: Implement Add dispute voting window and quorum requirement to resolve_dispute with explicit require_auth checks, clean storage layouts, and robust Soroban contract logic.
    • Testing & Verification: Add comprehensive unit tests verifying both happy-path invocations and unauthorized revert scenarios.
    • Delivery: Ready to ship a thoroughly tested PR within 12–24 hours with passing CI.

    Happy to pick this up today—please assign to me!

  3. guptakumarranjeet150 commented on Oct 3, 2026

    @guptakumarranjeet150

    Hi,

    I have experience with similar implementations and would like to take this on.

    Proposed steps:

    1. Audit storage layout and state invariants ensuring strict auth guards.
    2. Implement deterministic state transitions with safe checked arithmetic.
    3. Add hermetic unit and regression tests covering authorized, unauthorized, and boundary edge cases.
    4. Profile instruction and CPU/gas limits under Soroban host environment.

    Let me know if this aligns with the repository guidelines and assign when convenient.

  4. shobhamerabacha-star commented on Oct 3, 2026

    @shobhamerabacha-star

    Hi,

    I have experience with similar implementations and would like to take this on.

    Technical outline:

    1. Audit storage layout and state invariants ensuring strict auth guards.
    2. Implement deterministic state transitions with safe checked arithmetic.
    3. Add hermetic unit and regression tests covering authorized, unauthorized, and boundary edge cases.
    4. Profile instruction and CPU/gas limits under Soroban host environment.

    Please assign this to me if the plan looks good. Thanks!

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 OSSMaybe RewardedOfficial Campaign | FWC26bugdifficulty: hardpriority: high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions