Skip to content

[Governance 1/4] Introduce pallet-multi-collective#2805

Draft
l0r1s wants to merge 1 commit into
governance-umbrellafrom
governance-multi-collective
Draft

[Governance 1/4] Introduce pallet-multi-collective#2805
l0r1s wants to merge 1 commit into
governance-umbrellafrom
governance-multi-collective

Conversation

@l0r1s

@l0r1s l0r1s commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Motivation

This PR introduces the first standalone governance building block for named collectives. It provides bounded membership storage keyed by a runtime-defined CollectiveId, with per-collective configuration for names, minimum and maximum member counts, and optional term rotation cadence.

What Changed

  • Added pallet-multi-collective with membership extrinsics for adding, removing, swapping, and setting collective members.
  • Added optional scheduled rotation support via on_initialize and privileged manual rotation through force_rotate.
  • Added inspection APIs so downstream governance pallets can read current collective membership.
  • Added OnMembersChanged and OnNewTerm hook traits, including tuple implementations for fan-out composition.
  • Added benchmarks, generated weights, mock runtime support, README documentation, and unit tests covering membership bounds, ordering, origin checks, hook payloads, rotations, integrity checks, and try-state validation.
  • Wired the new pallet into workspace dependencies without integrating it into the runtime yet.

Files Of Interest

  • pallets/multi-collective/src/lib.rs: pallet storage, extrinsics, hooks, integrity checks, and inspection traits.
  • pallets/multi-collective/src/tests.rs: behavioral coverage for membership operations, rotations, invariants, and hook payloads.
  • pallets/multi-collective/src/benchmarking.rs: benchmark setup for all dispatchable calls and helper paths.
  • pallets/multi-collective/src/weights.rs: generated weights for the pallet.
  • common/src/traits.rs: shared OnMembersChanged trait and tuple implementation.

Behavioral Impact

This PR adds the pallet crate and shared trait surface, but does not yet instantiate the pallet in the runtime. Once wired, collective membership will be stored as sorted bounded vectors per collective, and configured origins will control each mutation path. Downstream pallets can observe membership changes through hooks and inspect membership through CollectiveInspect.

Migration / Spec Version

No storage migration is included because this is a new pallet. StorageVersion is pinned at 0, consistent with the repository's documented migration-run tracking approach. The PR targets governance-umbrella, which has no live-network spec-version check mapping, and the pallet is not yet wired into the runtime.

Testing

The PR includes unit tests for the new pallet and benchmark coverage for the dispatchable calls. Auditor attempted to run cargo test -p pallet-multi-collective, but the sandbox could not create rustup temp files under the read-only home directory.

@github-actions

github-actions Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

🛡️ AI Review — Skeptic (security review)

VERDICT: SAFE

BASELINE scrutiny: l0r1s has write permission and substantial contribution history; branch governance-multi-collective -> governance-umbrella; no Gittensor allowlist hit found in prefetched data.

Static-only Skeptic review of the prefetched diff found no .github/ai-review/* or .github/copilot-instructions.md modifications. The PR adds a new pallet-multi-collective with privileged origins for membership mutation, bounded member storage, checked/handled fallible paths in runtime code, and no new external supply-chain dependency beyond an already-workspace crate.

Findings

No findings.

Conclusion

No malicious intent or concrete security vulnerability found in the reviewed diff. Build/test execution was intentionally not performed under Skeptic rules.


🔍 AI Review — Auditor (domain review)

VERDICT: 👍

Gittensor: UNKNOWN; author has repo write permission and substantial prior Subtensor contribution history, so review calibrated as established contributor work.

PR body was empty/trivial; the Auditor has auto-filled it. Please review.

No blocking domain findings from static review. The PR introduces a standalone pallet-multi-collective, shared OnMembersChanged trait support, generated weights, benchmarks, and broad unit coverage; it does not wire the pallet into the runtime yet.

PR body is currently trivial (WIP), so I populated proposed_pr_body with a substantive description. Overlapping open PRs appear to be adjacent governance-stack/workspace work rather than better duplicate implementations of this pallet.

Verification note: attempted cargo test -p pallet-multi-collective, but the sandbox could not create rustup temp files under the read-only home directory (/home/runner/.rustup/tmp/...). No workspace files were modified.

Findings

No findings.

Conclusion

Approve on domain review: origins, bounds, sorted-storage invariants, hook payloads, try-state checks, benchmarks, and generated weights are covered in the implementation and tests. Residual risk is limited to the targeted test command not being runnable in this sandbox.

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👍

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