fix(governance): freeze signer roster changes while proposals are active - #1079
Merged
nanaf6203-bit merged 1 commit intoAug 29, 2026
Conversation
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
|
@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! 🚀 |
nanaf6203-bit
approved these changes
Aug 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolves #1024.
add_signer/remove_signercould be called at any time, whilevotereads the live signer count for its rejection math (votes_for + remaining < threshold). Removing a signer mid-vote shranktotal_signersand 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 newSignerChangesLockederror while any proposal isActive. With the roster frozen, the livesigners.len()used byvote,get_proposal_participation, andget_analyticsis 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_overrideremains 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
Activewith no expiry).Verification
cargo test -p governance— 38 passed, including two new tests:signer_changes_locked_while_proposal_activeandsigner_changes_allowed_after_proposal_closescargo clippy -p governance --all-targets -- -D warnings— cleancargo check --workspace— cleanCloses #1024