admin function can silently clear quorum-ready votes — prevent verifi…#566
admin function can silently clear quorum-ready votes — prevent verifi…#566EbukaMoses wants to merge 2 commits into
Conversation
|
@EbukaMoses Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
davidmaronio
left a comment
There was a problem hiding this comment.
this doesn't implement the fix yet, the diff only adds .kiro/specs/contract-improvements/design.md + requirements.md, there's no rust change to purge_voting_state to actually prevent the admin clearing quorum-ready votes. the ci red (fmt/clippy compile errors in admin.rs/create.rs/lib.rs/storage.rs) is from a stale base that doesn't compile, none of those files are in your diff. please rebase onto current main, add the actual implementation + a test, and drop the .kiro/specs docs (out of scope).
When a campaign has accumulated enough votes to satisfy both the quorum requirement and the approval-percentage threshold, the admin must not be able to silently erase that outcome by calling purge_voting_state with finalize_aggregate=true. Changes: - voting.rs: add has_met_quorum_and_threshold() helper that checks whether the current vote tallies already meet both the configured quorum count and the approval-bps threshold. - admin.rs: guard the finalize branch of purge_voting_state; return ValidationFailed when has_met_quorum_and_threshold() is true. - cancel.rs: preserve the aggregate vote state on cancellation when quorum has already been met, so the guard in purge_voting_state can still observe the outcome after cancellation. - test_purge_voting.rs: add three new tests covering the blocked-on-quorum path, the allowed non-finalize path, and the allowed sub-quorum path; update two existing tests that assumed cancel_campaign always cleared the aggregate (now only true when quorum has not been met).
ae8785b to
77361f4
Compare
|
@davidmaronio error fixed |
…able community governance
📌 Description
Provide a clear and concise description of the changes in this PR.
🔗 Related Issues
Use GitHub's auto-close keywords with the
#prefix (one issue per line):Closes #476
Close #481
Close #473
Multiple issues can be closed by repeating the keyword on separate lines.
🧪 Changes Made
✅ Checklist
If this PR introduces breaking changes, describe them here.
📸 Screenshots (if applicable)
Add screenshots to help reviewers understand the changes.
🧩 Additional Notes
Anything else reviewers should know.