Governance#2198
Open
l0r1s wants to merge 231 commits into
Open
Conversation
Contributor
|
🔄 AI review updated — Skeptic: VULNERABLE |
c0a3c6a to
16c83b2
Compare
Contributor
|
🔄 AI review updated — Skeptic: SAFE Auditor: 👎 |
1 similar comment
Contributor
|
🔄 AI review updated — Skeptic: SAFE Auditor: 👎 |
Contributor
|
🔄 AI review updated — Skeptic: SAFE Auditor: 👎 |
Contributor
|
🔄 AI review updated — Skeptic: SAFE Auditor: 👎 |
Contributor
|
🔄 AI review updated — Skeptic: SAFE Auditor: 👎 |
Contributor
|
🔄 AI review updated — Skeptic: SAFE Auditor: 👎 |
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.
Summary
Adds an on-chain governance stack to Subtensor: a two-stage referendum flow backed by signed collective voting, three new generic pallets, and the runtime wiring that turns them into Subtensor's concrete governance model.
Root calls now reach dispatch only after passing through both stages, replacing the current sudo-style path with a structured, auditable process.
This
governancePR is the umbrella / top-of-stack description for the full governance work. The implementation is being split into smaller reviewable PRs, but this description should explain the complete model and link the split PRs together.Technical explanation:
https://governance-visualization.a5ede37144f01bdc6a27.workers.dev
Non-technical explanation:
https://gov-novelty.a5ede37144f01bdc6a27.workers.dev
Split PR Stack
The full governance change is intentionally split into four PRs so each piece can be reviewed independently. The first three PRs add their pallets to the codebase only; they do not wire those pallets into the runtime. The final PR wires the stack together and adds the end-to-end tests.
pallet-multi-collective(this PR Governance #2198) — generic collective membership pallet. Codebase-only, not runtime-wired.Governance Flow
Proposerscollective submits a root call on the Triumvirate track.Triumviratevotes to approve or reject.EconomicandBuildingcollectives, who can fast-track, delay, or cancel enactment.New Pallets
pallet-multi-collective— generic membership storage for several named collectives under oneCollectiveId. Root-gated add/remove/swap/set, plus periodic term hooks for rotating collectives.pallet-referenda— generic track-based referendum state machine. SupportsPassOrFail(approve/reject/delegate) andAdjustable(timing decision over a scheduled call, with fast-track and cancel thresholds). Owns proposal queues, per-proposer quotas, terminal statuses, and atomic enact wrapping so dispatch and theEnactedstatus transition happen together.pallet-signed-voting— per-account aye/nay backend. Snapshots the eligible voter set when a poll opens and uses that snapshot for the entire poll, so later collective rotations cannot change who votes or shift the threshold denominator. Completed polls clean up vote records lazily during idle time.All three pallets are runtime-agnostic and independently tested.
Runtime Wiring (
runtime/src/governance)Defines two static tracks:
0triumvirateTriumvirate(3)PassOrFail, 7-day decision, 2/3 approve, 2/3 reject; approval delegates to track1.1reviewEconomic ∪ Building(≤32, dedup)Adjustable, 24h initial delay, 2-day max, 75% fast-track, 51% cancel, ease-out adjustment curve.And five collectives via
pallet-multi-collective:Proposers(curated, 1-20) — may submit proposals.Triumvirate(curated, fixed 3) — first-stage approval.Economic(rotating every 60 days, fixed 16) — top root-registered validator coldkeys by smoothed stake EMA.Building(rotating every 60 days, fixed 16) — top mature-subnet owners by best moving price.EconomicEligible(auto-synced, ≤64) — non-voting candidate pool feedingEconomic.Compile-time assertions tie pallet bounds (
MaxQueued,MaxVoterSetSize, cleanup capacity, etc.) to the actual collective sizes so misconfiguration fails at build time.CollectiveIdcodec indices are treated as consensus-facing and pinned.Economic and Building Selection
The runtime adds the rotation logic for both selectable collectives.
EconomicEligiblecoldkeys by a root-registered EMA value combining liquid TAO with the TAO value of alpha across owned hotkeys. Sampling is incremental (8 subnets and ≤256 hotkeys per tick), runs once per block from Subtensor'son_initialize, and uses alpha0.02. A 210-sample warmup (~30 days) gates eligibility.Both rotations require a full member set; if selection cannot produce 16 accounts the rotation fails safely and the previous membership remains.
Subtensor Integration
root_registeredmodule onpallet-subtensor: reference counting of root-registered hotkeys per coldkey, EMA storage, and anEmaValueProvidertrait the runtime implements for the stake-value sample.EconomicEligibleon0 ↔ 1transitions and initialize/clear EMA state accordingly.on_initializeadvances the EMA sampler each block; coldkey/hotkey swaps and UID changes maintain the tracking invariants.Documentation
New READMEs covering the model end to end:
docs/governance/README.md— overall flow, tracks, collectives, selection, lifecycle, review delay formula, events.runtime/src/governance/README.md— concrete runtime constants and rotation behavior.pallets/multi-collective/README.md,pallets/referenda/README.md,pallets/signed-voting/README.md— per-pallet architecture and configuration.Testing and Benchmarks
ts-tests/suites/dev/subtensor/governancecovering submission and origin guards, collectives, quotas, queue limits, voting, voter-set union, review scheduling and recovery paths, full-flow execution, and runtime-upgrade behavior.Safety Notes
referenda.enactwrapper, so stale scheduler entries on terminated referenda cannot run the inner call.