Skip to content

admin function can silently clear quorum-ready votes — prevent verifi…#566

Open
EbukaMoses wants to merge 2 commits into
Iris-IV:mainfrom
EbukaMoses:accept_campaign_transfer
Open

admin function can silently clear quorum-ready votes — prevent verifi…#566
EbukaMoses wants to merge 2 commits into
Iris-IV:mainfrom
EbukaMoses:accept_campaign_transfer

Conversation

@EbukaMoses

@EbukaMoses EbukaMoses commented Jun 30, 2026

Copy link
Copy Markdown

…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

  • Bug fix
  • New feature
  • Refactor
  • Documentation update

✅ Checklist

  • Code compiles successfully
  • Tests added/updated and passing
  • Linting passes (no warnings/errors)
  • Documentation updated (if required)
  • No breaking changes (or clearly documented)

⚠️ Breaking Changes

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.

@drips-wave

drips-wave Bot commented Jun 30, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@davidmaronio davidmaronio left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).
@EbukaMoses EbukaMoses force-pushed the accept_campaign_transfer branch from ae8785b to 77361f4 Compare July 7, 2026 12:39
@EbukaMoses

Copy link
Copy Markdown
Author

@davidmaronio error fixed

@EbukaMoses EbukaMoses requested a review from davidmaronio July 7, 2026 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants