Skip to content

Important: no way to extend deadlines on a live hackathon #24

@0xdevcollins

Description

@0xdevcollins

Severity: Important (UX)

Once submission_deadline or judging_deadline passes, it cannot be moved. Real hackathons extend constantly (server issues, holidays, organizer requests). Users will hit this regularly.

Fix

Add extend_submission_deadline and extend_judging_deadline:

pub fn extend_submission_deadline(
    env: Env,
    hackathon_id: u64,
    new_deadline: u64,
) -> Result<(), HackathonError> {
    let mut hackathon = Self::load_hackathon(&env, hackathon_id)?;
    hackathon.creator.require_auth();

    // Only extend forward, only while submissions are still open
    if new_deadline <= hackathon.submission_deadline {
        return Err(HackathonError::DeadlineMustExtend);
    }
    if env.ledger().timestamp() > hackathon.submission_deadline {
        return Err(HackathonError::DeadlineAlreadyPassed);
    }
    // Cap extension at 30 days from original
    if new_deadline > hackathon.submission_deadline + 30 * 86_400 {
        return Err(HackathonError::ExtensionTooLong);
    }
    // Maintain invariant: submission < judging
    if new_deadline >= hackathon.judging_deadline {
        return Err(HackathonError::InvalidDeadlines);
    }

    hackathon.submission_deadline = new_deadline;
    env.storage().persistent()
        .set(&HackathonDataKey::Hackathon(hackathon_id), &hackathon);
    SubmissionDeadlineExtended { hackathon_id, new_deadline }.publish(&env);
    Ok(())
}

Same shape for judging deadline.

Tests

  • Extend while still open → ok
  • Extend after expiry → rejected
  • Move backward → rejected
  • Too-long extension → rejected
  • Crosses next phase boundary → rejected

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