feat(events): stop enforcing the submission deadline on-chain#99
Conversation
The submission deadline was enforced by the contract (reject apply/submit/ withdraw_submission after it, require+future-check at create), but it gates nothing the contract is responsible for: - no money path reads it (since #61 the payout/refund liveness is anchored to select-time via PRIZE_CLAIM_WINDOW_SECS, not the deadline); - winners are the manager's discretion — select_winners never consults submissions, so a late submission row is inert; - permissionless-submit storage abuse is bounded by the #86 count cap, not the deadline. Meanwhile the deadline is immutable on-chain (no set/extend entrypoint), so the contract could not support the extensions organizers do routinely. A submission window — with its extensions, grace periods, and cutoffs — is a backend/product concern; the chain keeps only custody, the count cap, and discretionary winner selection. Remove the enforcement: - delete the deadline checks in submit / withdraw_submission / bounty apply and the create-time DeadlineMustBeFuture check; - drop the required-deadline check from hackathon/crowdfunding validate_create. Keep EventRecord.deadline as advisory metadata (still stored, emitted at create, backend-owned) — no storage-layout change, no ABI break. The now-dead DeadlineRequired/DeadlinePassed/DeadlineMustBeFuture variants are retired, freeing 3 slots against the 50-case error-enum cap. Removed the 5 tests that asserted the deleted behavior. 220 events + 66 profile green; make build OK (events 55,742 B); fmt clean.
Quota reachedYour plan allows 300 CI/CD file units per month. You've used 297 and this scan would add 8 more (total: 305). |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (8)
💤 Files with no reviewable changes (6)
📝 WalkthroughWalkthroughDeadline enforcement is removed from event creation, submissions, withdrawals, and bounty applications. Deadline-related errors and tests are deleted, while remaining pillar, status, authorization, and release validations stay intact. ChangesDeadline policy removal
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
) #99 changed contract behavior (submission deadline no longer enforced on chain) without a version bump. Bump events 1.4.0 -> 1.5.0 across INITIAL_VERSION, contractmeta, and the Cargo package version so the next testnet upgrade stamps a coherent version. Profile is unchanged by #99 and stays 1.2.0.
Why
The submission deadline was enforced by the contract, but it gates nothing the contract is actually responsible for — and it was immutable on-chain, so the contract couldn't support the extensions organizers do routinely.
Walking the cases (verified in code):
deadline. Since Competition/bounty payouts capped at 50 winners (MAX_WINNERS_PER_SELECT) — push-based select_winners can't scale #61, payout/refund liveness is anchored to selection time (PRIZE_CLAIM_WINDOW_SECS), not the deadline.select_winnersnever consults submissions — winners are the manager's discretion, picked by address. So a late submission row is inert.submitis bounded by the fix(events): cap per-event hackathon submissions to bound storage growth #86 count cap (5,000), not the deadline.So a submission window — with its extensions, grace periods, cutoffs — is a backend/product concern. The chain keeps only what it must: escrow custody, the count cap, and discretionary winner selection.
Change
Remove the enforcement only:
submit,withdraw_submission, and bountyapply;DeadlineMustBeFuturecheck;hackathon/crowdfundingvalidate_create.Keep
EventRecord.deadlineas advisory metadata — still stored, still emitted onEventCreated, now owned by the backend. This means:CreateEventParamsare untouched.submitted_at, so you retain on-chain proof of when something was submitted; the backend compares it to whatever the (flexible, extendable) deadline is.The now-dead
DeadlineRequired/DeadlinePassed/DeadlineMustBeFuturevariants are retired, which also frees 3 slots against the 50-case error-enum cap that #86/#88 kept bumping into.Verification
cargo test --workspace: 220 events + 66 profile green (removed the 5 tests that asserted the deleted behavior)make build(stellar-cli 27): events wasm 55,742 B (< 64 KB)cargo fmt --checkcleanNote
Physically removing the
deadlinefield later (if ever wanted) is a separate storage-migration task and deliberately not coupled here.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes