Skip to content

fix(governance): block execution of proposals with zero cast votes - #521

Open
rupesh-kumar-sah wants to merge 1 commit into
ChainLearnOfficial:mainfrom
rupesh-kumar-sah:fix/zero-vote-quorum-503
Open

rupesh-kumar-sah wants to merge 1 commit into
ChainLearnOfficial:mainfrom
rupesh-kumar-sah:fix/zero-vote-quorum-503

Conversation

@rupesh-kumar-sah

Copy link
Copy Markdown

Summary

Fixes a critical governance invariant violation where execute_proposal permitted proposals with zero cast votes to execute successfully with winning_choice = 0 and winning_votes = 0.

Changes

  • Added quorum validation in contracts/learn-token/src/lib.rs (execute_proposal) after tallying choices to explicitly panic with "no votes cast" when winning_votes == 0.
  • Added regression unit test test_execute_proposal_zero_votes_panics asserting that zero-vote proposals panic and cannot be executed by admin.

Closes #503

- 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
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.

execute_proposal succeeds with zero votes -- no quorum or minimum vote check

1 participant