Skip to content

Governance: minimal upgrade-gov pallet, remove community lane, harden tech collective#603

Closed
n13 wants to merge 2 commits into
mainfrom
governance/minimal-upgrade-gov
Closed

Governance: minimal upgrade-gov pallet, remove community lane, harden tech collective#603
n13 wants to merge 2 commits into
mainfrom
governance/minimal-upgrade-gov

Conversation

@n13

@n13 n13 commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

Replaces the public/token-weighted community governance lane with a minimal, upgrades-only governance pallet, keeps the tech-collective referenda lane as a transitional fallback, and fixes verified audit findings in the retained code.

New: pallet-upgrade-gov (pallet index 22)

  • M-of-N member approval + timelock that authorizes runtime upgrades via frame_system::authorize_upgrade only — a fixed Action enum, no arbitrary call dispatch.
  • Manages its own membership, threshold, and enactment delay on-chain (no external dependency for its own config).
  • on_initialize timelock; no Scheduler dependency.
  • Seeded at genesis with the same trusted set as the tech collective.
  • 11 unit tests.

Removed (community lane)

  • pallet-conviction-voting deleted.
  • Community Referenda instance (idx 10) and ConvictionVoting (idx 12) removed; indices kept vacant so downstream pallet indices stay stable. CommunityTracksInfo removed.
  • Dead community-lane integration tests (engine.rs, logic.rs).

Retained as transitional fallback

  • TechCollective (pallet-ranked-collective) + TechReferenda (pallet-referenda Instance1). Plan: prove a runtime upgrade through pallet-upgrade-gov, then remove the tech lane in a follow-up.

Audit fixes in retained code

Finding Fix
#91267 Tech-collective AddOrigin/RemoveOrigin are now EnsureRootWithSuccess<AccountId, ConstU16<0>> (Root-only, i.e. a passed referendum) instead of any single member. Dead RootOrMemberForCollectiveOrigin helper deleted.
#91248 Removed unreachable Root branch in RootOrMemberForTechReferendaOrigin.
#91272 Referenda submission deposit now refundable for Rejected/TimedOut (previously frozen).
#91165 Preimage per-byte deposit corrected (was 1000x too low).

spec_version bumped 132 → 133.

Test plan

  • cargo test -p pallet-upgrade-gov — 11 passed
  • cargo test -p quantus-runtime --features fast-governance — 23 passed, 1 ignored
  • cargo check -p quantus-runtime (std) and --features runtime-benchmarks — clean
  • cargo build -p quantus-runtime (native + WASM artifact) — clean
  • Reviewer: confirm pallet-upgrade-gov Action enum is limited to authorize-upgrade + self-config (no arbitrary Root dispatch)
  • Reviewer: confirm vacated pallet indices (10, 12) cause no migration issues
  • On-chain: dry-run a runtime upgrade via pallet-upgrade-gov before removing the tech lane

Known open items (transitional lane)

  • #91265 (a removed member's already-cast votes stay counted in a live referendum) is not fixed — accepted risk for the short, trusted transition; eliminated when the tech lane is removed.

n13 added 2 commits June 24, 2026 14:52
… tech collective

Replace the public/token-weighted community governance lane with a minimal,
upgrades-only governance pallet, keep the tech-collective referenda lane as a
transitional fallback, and fix verified audit findings in the retained code.

New:
- pallet-upgrade-gov (index 22): M-of-N member approval + timelock that
  authorizes runtime upgrades via frame_system::authorize_upgrade only. Fixed
  Action enum (no arbitrary dispatch), internal membership/threshold/delay
  management, on_initialize timelock. Seeded at genesis with the same trusted
  set as the tech collective. 11 unit tests.

Removed (community lane):
- pallet-conviction-voting (deleted).
- Community Referenda instance (idx 10) and ConvictionVoting (idx 12); indices
  kept vacant. CommunityTracksInfo removed.
- Dead community-lane integration tests (engine.rs, logic.rs).

Retained as transitional fallback: TechCollective + TechReferenda, to be removed
once upgrades via pallet-upgrade-gov are proven on-chain.

Audit fixes in retained code:
- #91267: tech-collective Add/RemoveOrigin now EnsureRootWithSuccess (Root-only,
  i.e. a passed referendum) instead of any single member.
- #91248: removed dead Root branch in RootOrMemberForTechReferendaOrigin.
- #91272: referenda submission deposit now refundable for Rejected/TimedOut.
- #91165: preimage per-byte deposit corrected (was 1000x too low).

spec_version 132 -> 133.
n13 added a commit that referenced this pull request Jun 24, 2026
* governance: minimal upgrade-gov pallet, remove community lane, harden tech collective

Replace the public/token-weighted community governance lane with a minimal,
upgrades-only governance pallet, keep the tech-collective referenda lane as a
transitional fallback, and fix verified audit findings in the retained code.

New:
- pallet-upgrade-gov (index 22): M-of-N member approval + timelock that
  authorizes runtime upgrades via frame_system::authorize_upgrade only. Fixed
  Action enum (no arbitrary dispatch), internal membership/threshold/delay
  management, on_initialize timelock. Seeded at genesis with the same trusted
  set as the tech collective. 11 unit tests.

Removed (community lane):
- pallet-conviction-voting (deleted).
- Community Referenda instance (idx 10) and ConvictionVoting (idx 12); indices
  kept vacant. CommunityTracksInfo removed.
- Dead community-lane integration tests (engine.rs, logic.rs).

Retained as transitional fallback: TechCollective + TechReferenda, to be removed
once upgrades via pallet-upgrade-gov are proven on-chain.

Audit fixes in retained code:
- #91267: tech-collective Add/RemoveOrigin now EnsureRootWithSuccess (Root-only,
  i.e. a passed referendum) instead of any single member.
- #91248: removed dead Root branch in RootOrMemberForTechReferendaOrigin.
- #91272: referenda submission deposit now refundable for Rejected/TimedOut.
- #91165: preimage per-byte deposit corrected (was 1000x too low).

spec_version 132 -> 133.

* format

* governance: drop pallet-upgrade-gov, harden tech-collective lane

Alternative to the pallet-upgrade-gov approach (#603): keep the tech-collective
referenda lane as the sole governance mechanism and harden it, rather than
adding a new minimal upgrade pallet. Builds on the shared base (community lane
removed, #91267/#91248/#91272/#91165 fixed).

Removed:
- pallet-upgrade-gov (crate, runtime wiring, config, genesis seeding). The tech
  lane authorizes runtime upgrades and other Root calls directly.

Tech-lane audit fixes (local referenda fork + runtime config):
- #91247/#91270 (high): TechCollectiveTracksInfo::track_for now accepts only a
  Root proposal origin. Previously any Signed(_) mapped to track 0, so a passed
  referendum could dispatch as an arbitrary account (impersonation) or route
  Root-level dispatch through the single low-threshold track. All legitimate
  submissions already use a Root proposal origin.
- #91271 (high): ready_for_deciding honors the bounded-queue insertion result
  instead of unconditionally setting in_queue = true, preventing ghost-queued
  referenda (skipped by timeout yet absent from TrackQueue).
- #91210 (high): schedule_enactment and set_alarm log a loud error on scheduler
  failure instead of failing silently (debug_assert-only in release).
- #91213 (low): cancel/kill only release a deciding slot when the referendum
  actually held one, preventing DecidingCount corruption (relevant at
  max_deciding = 1).

Parameter hardening:
- TechReferenda prepare_period 20 blocks (4 min) -> 2 hours of advance notice.
- UndecidingTimeout comment corrected (value is 45 days, not 90).

Moot via the community-lane removal already on this branch:
- #91141 (abstentions satisfy approval), #91166 (self-vote weight): both were
  pallet-conviction-voting issues; that pallet is deleted.
- #91193 (unbounded member exchange): exchange_member is NeverEnsureOrigin.
- #91265 (removed members' votes): non-issue (upstream ranked-collective
  behavior; membership changes are Root-gated and rare).

Tests: pallet-referenda 39/39; runtime governance 23 passed/1 ignored; native +
WASM build and runtime-benchmarks compile clean.

* format
@n13

n13 commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator Author

#604 is a better solution - closing

@n13 n13 closed this Jun 24, 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.

1 participant