Skip to content

Important: finalize_hackathon sort has non-deterministic ties #19

@0xdevcollins

Description

@0xdevcollins

Severity: Important (fairness)

The sort uses strict > comparison:

if avg > scores.get(j).unwrap() {
    // insert
}

Two teams with identical average scores are ranked by iteration order over storage — effectively arbitrary. Team A gets first prize, Team B gets second, with no defined tiebreaker.

Fix

Define a documented tiebreaker. Recommendation:

  1. Higher average score wins.
  2. Tie → earlier submitted_at wins (rewards early submission).
  3. Still tied → more distinct judges scoring (score_count) wins.
  4. Still tied → lower address hash (deterministic fallback).

Tests

  • Two identical-score submissions: earlier submitter wins
  • Same submission time: more judges wins
  • All tied: deterministic across runs

Metadata

Metadata

Assignees

No one assigned

    Labels

    audit-findingSurfaced during internal audit / reviewbugSomething isn't workingenhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions