Skip to content

fix(governance): freeze signer roster changes while proposals are active - #1079

Merged
nanaf6203-bit merged 1 commit into
MettaChain:mainfrom
jonathanayubausara-a11y:fix/governance-signer-roster-freeze
Aug 29, 2026
Merged

fix(governance): freeze signer roster changes while proposals are active#1079
nanaf6203-bit merged 1 commit into
MettaChain:mainfrom
jonathanayubausara-a11y:fix/governance-signer-roster-freeze

Conversation

@jonathanayubausara-a11y

Copy link
Copy Markdown
Contributor

Summary

Resolves #1024. add_signer/remove_signer could be called at any time, while vote reads the live signer count for its rejection math (votes_for + remaining < threshold). Removing a signer mid-vote shrank total_signers and could force an early rejection; adding one could keep a doomed proposal alive — so the outcome depended on when the admin happened to edit the roster.

Chosen policy (documented on add_signer/remove_signer): roster freeze. Roster changes are rejected with the new SignerChangesLocked error while any proposal is Active. With the roster frozen, the live signers.len() used by vote, get_proposal_participation, and get_analytics is stable, so a proposal's pass/reject outcome can never depend on a mid-vote roster edit. The roster unlocks automatically once all active proposals close (active_proposal_count == 0); emergency_override remains available for urgent cases.

This avoids the storage migration and liveness edge cases of the snapshot alternative (a snapshot would count removed signers as "remaining votes" even though they can no longer vote, potentially leaving a proposal stuck in Active with no expiry).

Verification

  • cargo test -p governance — 38 passed, including two new tests: signer_changes_locked_while_proposal_active and signer_changes_allowed_after_proposal_closes
  • cargo clippy -p governance --all-targets -- -D warnings — clean
  • cargo check --workspace — clean

Closes #1024

vote and get_proposal_participation read the live signer count, so
add_signer/remove_signer mid-vote silently altered a proposal's quorum
math: removing a signer could force an early rejection and adding one
could keep a doomed proposal alive. Roster changes are now rejected with
SignerChangesLocked while any proposal is Active (the chosen policy, per
Issue MettaChain#1024), keeping a proposal's pass/reject outcome independent of
when the admin edits the signer set; the roster unlocks again once all
active proposals close.

Closes MettaChain#1024
@drips-wave

drips-wave Bot commented Aug 27, 2026

Copy link
Copy Markdown

@jonathanayubausara-a11y 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

@nanaf6203-bit
nanaf6203-bit merged commit 174a499 into MettaChain:main Aug 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Governance signer set can change mid-vote: add_signer/remove_signer alter quorum math on active proposals

2 participants