Skip to content

cli: filter low-stake validators from PAT broadcast/check - #906

Merged
LandynDev merged 2 commits into
testfrom
feat/validator-pat-broadcast-filter
Apr 30, 2026
Merged

cli: filter low-stake validators from PAT broadcast/check#906
LandynDev merged 2 commits into
testfrom
feat/validator-pat-broadcast-filter

Conversation

@anderdc

@anderdc anderdc commented Apr 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • gitt miner post / gitt miner check now require a validator to have vtrust > 0.25 (was 0.1), be serving an axon, and hold ≥ 15,000 α stake before being targeted with a PAT broadcast or probe.
  • --min-vtrust / --min-stake CLI flags let a miner override the defaults; no config-file knob.
  • New "Skipped Validators" table surfaces high-vtrust UIDs filtered by the stake or serving check, with per-UID reasons; JSON output gains a matching skipped field.

Why

Low-stake weight-copiers can clear vtrust > 0.1 and a serving axon yet have no operational need for miners' GitHub credentials. Receiving them just expands the credential blast radius. On netuid 74 today there is one such UID (147: vtrust 0.997, stake ~1,630 α). The new defaults cleanly exclude it without affecting any honest validator (the next-lowest serving validator sits at ~43k α, a ~26× headroom).

A miner running gitt miner post on finney now broadcasts to 7 validators (was 8) and sees an explanatory table for the 5 high-vtrust UIDs that get skipped (UID 147 by stake; UIDs 102/173/174/195 because they don't advertise an axon — pre-existing structural gap, now visible).

Test plan

  • ruff check / ruff format --check clean on changed files (one pre-existing import-order issue in neurons/validator.py left alone)
  • pyright clean (0 errors / 0 warnings)
  • pytest tests/cli/test_miner_commands.py — 15 pass (6 new in TestValidatorAxonFilter: pass-all, silent sub-vtrust drop, not-serving, stake-below, multi-reason combo)
  • Full pytest — 701 pass; one unrelated failure (test_register_exits_non_zero_when_contract_metadata_missing) reproduces on test with this branch stashed
  • Reviewer: optionally dry-run gitt miner post --json-output --network finney and verify the skipped array matches expectations

`gitt miner post` and `gitt miner check` previously broadcast PATs to any
validator with vtrust > 0.1 and a serving axon. Low-stake weight-copiers
satisfy that filter and end up receiving real GitHub credentials they
have no operational need for, expanding the credential surface.

Tighten the filter to require:
  - validator_trust > min_vtrust (default 0.25, was 0.1)
  - axon.is_serving
  - stake >= min_stake (default 15,000 alpha, was unbounded)

Both thresholds are configurable per miner via `--min-vtrust` /
`--min-stake` flags or `min_validator_vtrust` / `min_validator_stake`
keys in ~/.gittensor/config.json (resolution order: flag > config >
default). The historical `--blacklist.min_stake=30000` precedent from
the original miner template informed the default.

A new "Skipped Validators" table surfaces high-vtrust UIDs filtered by
the stake or serving check, with per-UID reasons, so miners can see why
a known validator did not receive a broadcast. JSON output gains a
matching `skipped` field.

Filter logic and resolution moved into shared helpers consumed by both
post and check to avoid duplication.
@xiao-xiao-mao xiao-xiao-mao Bot added the enhancement New feature or request label Apr 30, 2026
Resolution is now CLI flag → built-in default. Removes
`_resolve_validator_filters` and the matching config keys; click's
`default=` plus `show_default=True` handles both the value and the
help text.

The flag lets miners override; everyone else gets the default. The
config-file path was unnecessary surface area for a knob most miners
won't touch.
@LandynDev
LandynDev merged commit 3cdd990 into test Apr 30, 2026
3 checks passed
statxc added a commit to statxc/gittensor that referenced this pull request May 5, 2026
When --min-stake / --min-vtrust eliminate every high-vtrust candidate,
_require_validator_axons discarded the `excluded` payload that the success
path already exposes and emitted only the generic "No reachable validator
axons found on the network." message. Operators hitting this case are
exactly the ones who need the diagnostic.

Branch on whether `excluded` is non-empty: TTY renders the existing
Skipped Validators table before the error, JSON includes the `skipped`
array on the error envelope, and the error message names the active
thresholds. The original generic message is preserved when the metagraph
carries no candidates at all (n=0 or every UID below min_vtrust).

entrius#906 introduced the filtering knobs and `excluded` list and wired them
into the success path; the error path was missed in the same change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants