Skip to content

fix(governance-dao): reject duplicate proposals in create_proposal - #711

Merged
nonsobethel0-dev merged 1 commit into
Parashield-Protocol:mainfrom
MissHarah:fix/630-prevent-duplicate-proposals
Oct 20, 2026
Merged

nonsobethel0-dev merged 1 commit into
Parashield-Protocol:mainfrom
MissHarah:fix/630-prevent-duplicate-proposals

Conversation

@MissHarah

Copy link
Copy Markdown
Contributor

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

…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
@drips-wave

drips-wave Bot commented Oct 19, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@nonsobethel0-dev
nonsobethel0-dev merged commit d8ff905 into Parashield-Protocol:main Oct 20, 2026
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.

[bug] RiskPool does not validate LP has enough shares for withdrawal [security] GovernanceDAO does not validate proposal is not duplicate

2 participants