[Governance 1/4] Introduce pallet-multi-collective#2805
Conversation
🛡️ 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 FindingsNo findings. ConclusionNo 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 PR body is currently trivial ( Verification note: attempted FindingsNo findings. ConclusionApprove 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. |
|
🔄 AI review updated — Skeptic: SAFE Auditor: 👍 |
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
pallet-multi-collectivewith membership extrinsics for adding, removing, swapping, and setting collective members.on_initializeand privileged manual rotation throughforce_rotate.OnMembersChangedandOnNewTermhook traits, including tuple implementations for fan-out composition.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: sharedOnMembersChangedtrait 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.
StorageVersionis pinned at0, consistent with the repository's documented migration-run tracking approach. The PR targetsgovernance-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.