Repository navigation
fix(governance-dao): reject duplicate proposals in create_proposal - #711
Merged
nonsobethel0-dev merged 1 commit intoOct 20, 2026
Conversation
…arashield-Protocol#630) A proposer could submit the same governance action (identical target, function, and args) multiple times, creating competing proposals that split voter attention and waste deposit capital on redundant governance. Changes: - Add Error::DuplicateProposal = 50 - Add StorageKey::ActiveProposalHash(BytesN<32>) — maps a SHA-256 hash of (target, function, args) to the open proposal_id - Add proposal_content_hash() private helper (SHA-256 preimage built from the 56-byte target strkey + function val u64 + each arg val u64) - Add clear_proposal_hash() private helper - create_proposal: check hash before any state write; register hash after proposal is written; only blocks while an open (Active or Discussion) proposal with the same action exists - propose_upgrade: same duplicate check and hash registration - finalize, finalize_batch, cancel, reclaim_deposit: call clear_proposal_hash so the same action can be re-proposed once the previous one resolves - 6 new tests: duplicate rejected (same title), duplicate rejected (different title), different function allowed, different target allowed, re-proposal allowed after cancel, re-proposal allowed after finalize
|
@MissHarah 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! 🚀 |
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.
Create_proposal had no check for duplicate proposals. A proposer could submit the same governance action multiple times, creating competing proposals that split voter attention and waste deposit capital.
Changes:
Added Error::DuplicateProposal = 50
Added a SHA-256 content hash over (target, function, args) stored as ActiveProposalHash in instance storage while the proposal is open
Duplicate check added to both create_proposal and propose_upgrade before any state write or deposit transfer
Hash is cleared when a proposal resolves via finalize, finalize_batch, cancel, or reclaim_deposit, so the same action can be re-proposed legitimately after it closes
Added 6 new tests covering: same action rejected, different title still rejected, different function allowed, different target allowed, re-proposal allowed after cancel, re-proposal allowed after finalize
Closes #630
Closes #631