Skip to content

Validator-voted repository weight consensus#1651

Open
LandynDev wants to merge 2 commits into
testfrom
feat/validator-repo-weight-consensus
Open

Validator-voted repository weight consensus#1651
LandynDev wants to merge 2 commits into
testfrom
feat/validator-repo-weight-consensus

Conversation

@LandynDev

@LandynDev LandynDev commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

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.json emission 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_consensus overlay), 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_refresh tick outside the round gate + run_weight_consensus overlay on the loaded registry
  • neurons/validator.py: ConsensusManager init + snapshot store hook (baskets + aggregate to postgres when STORE_DB_RESULTS is on; powers dashboards, tables land in gittensor-db)
  • Constants in validator/utils/config.py, flags --neuron.consensus_prefs_path / --neuron.disable_weight_consensus
  • 57 tests: codec fuzz cases, golden aggregation vector, shuffled-input determinism (byte-identity), cache/fallback behavior matrix, never-raises orchestrator
  • README: consensus summary + archive endpoint recommendation (lite nodes prune snapshot state; fallback is graceful either way)

Deferred decisions (team to revisit post-merge; all one-line changes)

  • CONSENSUS_MAX_REPOS = 10 basket cap

  • CONSENSUS_MIN_VALIDATOR_STAKE_RAO = 30k alpha voter threshold

  • CONSENSUS_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.json PR (novel repos run code defaults); consider a seamless API endpoint for tuning later

  • Alpha 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 weights CLI (interactive basket set/show, mirror-trackability guardrail) + docs
  • gittensor-db tables validator_weight_baskets / repo_weight_consensus, DAS endpoint, subtle UI section
  • Mirror admin endpoints (GET /admin/repos, POST /admin/repos/deregister) + env-gated mirror sync with dereg hysteresis

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