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
Severity: Important (UX)
Once
submission_deadlineorjudging_deadlinepasses, it cannot be moved. Real hackathons extend constantly (server issues, holidays, organizer requests). Users will hit this regularly.Fix
Add
extend_submission_deadlineandextend_judging_deadline:Same shape for judging deadline.
Tests