Skip to content

Harden KOTH weight inputs and fallback - #434

Closed
kenobijon wants to merge 1 commit into
feat/koth-phase-afrom
codex/harden-koth-control-plane
Closed

Harden KOTH weight inputs and fallback#434
kenobijon wants to merge 1 commit into
feat/koth-phase-afrom
codex/harden-koth-control-plane

Conversation

@kenobijon

@kenobijon kenobijon commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • overlay partial API split updates on the 40/40/4/16 defaults and reject non-numeric, non-finite, negative, or non-unit effective splits
  • validate current and historical king addresses before caching or allocating weights
  • expire last-known-good king data after 24 hours and require the owner/burn UID for every submission
  • reject incomplete final weight vectors before Bittensor normalization
  • fix the PM2 benchmark API argument name

Verification

  • 73 tests passed
  • CI-equivalent Ruff checks passed
  • Python compile checks passed
  • validator.config.js syntax check passed
  • focused Bandit scan found no medium/high issues

Note

High Risk
Changes on-chain weight allocation and trust boundaries for external KOTH API data; mis-validation or cache behavior could mis-route emissions or burn discriminator share incorrectly.

Overview
Hardens King-of-the-Hill (KOTH) weight setting so validators only trust validated API data and fail safely when inputs are bad or stale.

Adds resolve_koth_split and validate_koth_payload: partial API splits overlay on protocol defaults; splits must be numeric, finite, non-negative, and sum to 1. Current-kings responses are normalized to kings, chain, and split only, with SS58 checks, one king per modality, and chain heads aligned with current kings.

build_koth_weights now requires a valid owner/burn UID before building weights, deduplicates generator UIDs, and rejects non-unit or invalid final vectors. Modality lists use KOTH_MODALITIES.

The validator validates live and cached current-kings payloads, persists fetched_at with a 24-hour TTL (legacy caches without timestamps are treated stale), and falls back to empty kings plus KOTH_SPLIT when nothing valid is available—discriminator share burns with clearer logging.

validator.config.js fixes the PM2 CLI flag to --benchmark-api-url. New tests cover cache TTL/persistence and validation edge cases.

Reviewed by Cursor Bugbot for commit 234932a. Bugbot is set up for automated code reviews on this repo. Configure here.

@kenobijon kenobijon closed this Sep 4, 2026
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