fix(governance): block execution of proposals with zero cast votes - #521
Open
rupesh-kumar-sah wants to merge 1 commit into
Open
rupesh-kumar-sah wants to merge 1 commit into
rupesh-kumar-sah wants to merge 1 commit into
Conversation
- Add quorum validation in `execute_proposal` to panic with 'no votes cast' when winning_votes == 0 - Prevent zero-vote proposals from executing with winning_choice 0 - Add unit test verifying execute_proposal panics on zero-vote proposals Closes ChainLearnOfficial#503
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
Fixes a critical governance invariant violation where
execute_proposalpermitted proposals with zero cast votes to execute successfully withwinning_choice = 0andwinning_votes = 0.Changes
contracts/learn-token/src/lib.rs(execute_proposal) after tallying choices to explicitly panic with"no votes cast"whenwinning_votes == 0.test_execute_proposal_zero_votes_panicsasserting that zero-vote proposals panic and cannot be executed by admin.Closes #503