GeezerVison is showing github.com — fix(validator): say the chain preflight is skipped without a hotkey · CortexLM/cortex@f8f10a9
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: deploy/README.md +14Lines changed: 14 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -196,6 +196,20 @@ reports `validator outcome=verified` for the same root/vector from historical | 196 | 196 | chain state. The unsealed UID0 fallback is a readiness failure, not a weight to | 197 | 197 | submit. | 198 | 198 |
| | 199 | +`outcome=verified` from the hotkey-less role says nothing about the hotkey: it | | 200 | +logs `preflight=skipped` and does not check hotkey registration, validator permit | | 201 | +or the weight rate limit. There is no submission-off switch on the weight-setter, | | 202 | +so check the hotkey before starting it, on the weight-setter host: | | 203 | + | | 204 | +1. Run `WALLET_NAME=... WALLET_HOTKEY=... scripts/run-validator.sh --verify-only` | | 205 | + (or `cortex validator --verify-only --once` with `--wallet-name`, | | 206 | + `--wallet-hotkey` and `--wallet-path`). With a hotkey, verify-only runs the same | | 207 | + chain preflight as a submission and never submits: the hotkey must be | | 208 | + registered on the netuid, hold a validator permit, have its weight rate limit | | 209 | + elapsed (`blocks_since_last_update > weights_rate_limit`) and the chain limits | | 210 | + must accept the sealed vector. A refusal prints `chain_preflight_failed`. | | 211 | +2. Only then start `role-weight-setter.yml`. | | 212 | + | 199 | 213 | To run a validator without Compose, use `scripts/run-validator.sh` from a | 200 | 214 | repository clone. It needs `WALLET_NAME` and `WALLET_HOTKEY` only to submit weights | 201 | 215 | (`--verify-only` needs neither), reads the | |
Collapse file Copy file name to clipboardExpand all lines: docs/external-miner/validators.md +11Lines changed: 11 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -154,6 +154,17 @@ never claims its epoch in the journal and never creates an extrinsic. It exits | 154 | 154 | successfully only for the exact `verified` outcome; unsealed, changed, degraded | 155 | 155 | or peer-unavailable states return a nonzero process status. | 156 | 156 |
| | 157 | +Without a hotkey, verify-only logs `preflight=skipped`: it does **not** check | | 158 | +hotkey registration, validator permit or the weight rate limit, so `verified` | | 159 | +proves the seal, not that this hotkey can submit. Before the first submission, | | 160 | +run verify-only once more with `--wallet-name` and `--wallet-hotkey` (both or | | 161 | +neither; one alone is refused): it then runs the full chain preflight of a | | 162 | +submission (registered on the netuid, validator permit, rate limit elapsed, | | 163 | +chain weight limits) without submitting, and a refusal is | | 164 | +`chain_preflight_failed`. Start the submitting validator only after that run is | | 165 | +`verified`; it has no submission-off switch. A hotkey file that cannot be read | | 166 | +stops the process at startup. | | 167 | + | 157 | 168 | For Compose use the Python | 158 | 169 | [validator environment example](../../deploy/env/python-validator.env.example) | 159 | 170 | with the verify-only [validator role](../../deploy/compose/role-validator.yml) (no | |
Collapse file Copy file name to clipboardExpand all lines: src/cortex/validator/__main__.py +5Lines changed: 5 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -272,6 +272,11 @@ def main(argv: list[str] | None = None) -> None: | 272 | 272 | raise SystemExit( | 273 | 273 | f"validator hotkey unreadable under --wallet-path: {type(error).__name__}" | 274 | 274 | ) from None | | 275 | + elif arguments.verify_only: | | 276 | + logging.warning( | | 277 | + "validator preflight=skipped: no hotkey, so registration, validator permit " | | 278 | + "and weight rate limit are not checked" | | 279 | + ) | 275 | 280 | subtensor = Subtensor( | 276 | 281 | network=arguments.network, fallback_endpoints=arguments.fallback_endpoints | 277 | 282 | ) | |
Collapse file Copy file name to clipboardExpand all lines: tests/validator/test_main.py +14Lines changed: 14 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -247,3 +247,17 @@ def test_weight_setter_with_a_missing_hotkey_file_fails_at_startup(monkeypatch, | 247 | 247 | with pytest.raises(SystemExit, match="hotkey unreadable") as refused: | 248 | 248 | validator_main.main(arguments) | 249 | 249 | assert "default" not in str(refused.value) and "wallets" not in str(refused.value) | | 250 | + | | 251 | + | | 252 | +def test_verify_only_without_hotkey_logs_that_the_chain_preflight_is_skipped( | | 253 | + monkeypatch, tmp_path, caplog | | 254 | +): | | 255 | + fake_chain_modules(monkeypatch) | | 256 | + | | 257 | + async def verified(arguments, subtensor, wallet): | | 258 | + return TickResult("verified") | | 259 | + | | 260 | + monkeypatch.setattr(validator_main, "run", verified) | | 261 | + validator_main.main([*without_hotkey(tmp_path), "--verify-only", "--once"]) | | 262 | + assert "preflight=skipped" in caplog.text | | 263 | + assert "validator permit" in caplog.text |
|