Skip to content

Governance E2E tests: negative referenda test cases #492

@rockbmb

Description

@rockbmb

Test scenarios for referenda that fail due to missing deposits or insufficient support/approval. These tests cover all negative outcomes that can actually happen in pallet_referenda.

  • Missing decision deposit

    • Submit a referendum without paying the decision deposit.
    • Ensure it never enters Deciding and is automatically rejected or cleaned up after the undeciding timeout.
    • Check correct events (TimedOut, DepositRefunded/Slashed) and state transitions.
  • Insufficient support

    • Enter Deciding phase with decision deposit paid.
    • Cast votes so that support (proportion of aye vs possible votes) stays below the track’s minimum support threshold.
    • Expected outcome: referendum rejected for insufficient support.
  • Insufficient approval

    • Enter Deciding phase with decision deposit paid.
    • Cast votes so support meets the minimum, but approval (vote-weight adjusted) is below the track’s required approval curve.
    • Expected outcome: referendum rejected for insufficient approval.
  • Track capacity / queue overflow (optional)

    • Submit more referenda than max_deciding allows.
    • Verify that queued referenda are handled correctly
  • Assertions for all scenarios

    • Correct state transitions: Submitted → deposit → DecidingRejected / TimedOut.
    • Correct events emitted: DecisionDepositPlaced, DecisionStarted, Rejected, TimedOut, DepositRefunded / DepositSlashed.
    • Correct application of track curves for support and approval.
    • Deposit refund or slashing behaves according to outcome.

Metadata

Metadata

Assignees

No one assigned

    Labels

    e2e testsRelated to end-to-end testsenhancementNew feature or request

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions