Validator-voted repository weight consensus#1651
Open
LandynDev wants to merge 2 commits into
Open
Conversation
This was referenced Jul 24, 2026
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
Repository emission shares become validator-voted instead of hardcoded. Each validator publishes a basket of up to 10 repos to the commitments pallet; every validator applies the stake-weighted mean of all eligible baskets, aggregated at a fixed snapshot block (
B = block - block % 3600, ~2x/day), so all validators derive byte-identical weights and vtrust is unaffected.Motivation
master_repositories.jsonemission shares are law-in-code: every share change requires a PR and validators have no say. This moves repo weight control to validators while keeping weight vectors identical across the subnet (consensus moves one layer up, mirroring Yuma's own stake-weighted mechanism).Changes
gittensor/validator/weight_consensus/new package:codec(zlib payload, u16 weights),consensus(big-int stake-weighted mean, activation gate,apply_consensusoverlay),chain(raw query_map/BigRaw paths; SDK helpers are lossy for binary),publisher(vote from local prefs file or baked shares, republish only on change),manager(warm compute at snapshot boundaries, numerator disk cache, last-good -> baked fallback chain; never raises)forward.py:maybe_refreshtick outside the round gate +run_weight_consensusoverlay on the loaded registryneurons/validator.py:ConsensusManagerinit + snapshot store hook (baskets + aggregate to postgres whenSTORE_DB_RESULTSis on; powers dashboards, tables land in gittensor-db)validator/utils/config.py, flags--neuron.consensus_prefs_path/--neuron.disable_weight_consensusDeferred decisions (team to revisit post-merge; all one-line changes)
CONSENSUS_MAX_REPOS = 10basket capCONSENSUS_MIN_VALIDATOR_STAKE_RAO = 30k alphavoter thresholdCONSENSUS_SNAPSHOT_INTERVAL_BLOCKS = 3600(~2x/day recalc)Non-voting validators: warn-only bystander mode now; termination alongside the warning deliberately deferred
Activation gate
>= 50%of eligible stake voted (below -> baked JSON; safe rollout)Stake-weighted mean (vs median) aggregation
Per-repo scoring hyperparams for newly voted repos still require a
master_repositories.jsonPR (novel repos run code defaults); consider a seamless API endpoint for tuning laterAlpha cost: should registering a repository outright require a Gittensor alpha payment?
Aggregate min-support threshold (guardrail Gt 79 #2): require a repo to exceed x% (e.g. 5%) of the aggregated weight vector before it enters the effective repo list. A 30k-alpha validator voting some repo at 100% of their basket lands at well under 1% of the stake-weighted aggregate and would be excluded until broader support exists. Currently OFF (pure mean, no threshold).
Follow-ups (separate PRs)
gitt validator weightsCLI (interactive basket set/show, mirror-trackability guardrail) + docsgittensor-dbtablesvalidator_weight_baskets/repo_weight_consensus, DAS endpoint, subtle UI sectionGET /admin/repos,POST /admin/repos/deregister) + env-gated mirror sync with dereg hysteresis