The Scoring API is a specialized validator node that provides centralized scoring for the RedTeam Subnet (netuid 61). It extends the standard Validator functionality but focuses exclusively on scoring and comparing miner submissions rather than querying miners or setting weights directly.
- Centralized scoring infrastructure for all subnet validators
- Aggregation of miner submissions from all active validators
- Automatic deduplication and versioning of submissions
- Challenge-specific scoring and comparison controllers
- Daily score processing at predetermined hours (SCORING_HOUR constant)
- In-memory and persistent caching of scoring results
- RESTful API for validators to retrieve scoring results
- Prometheus metrics for monitoring
The scoring API server maintains several important state variables:
validators_miner_commits: Stores current miner commits from all validators, indexed by validator UID and hotkeyminer_commits: Aggregated miner commits from all validators, indexed by miner UID and hotkeyminer_commits_cache: Quick lookup cache mapping challenge+encrypted_commit to commit objectsscoring_results: Cache for scored submissions with scoring logs and comparison logs
-
Validation Loop (
forwardmethod)- Updates validator and miner commit state
- Scores new submissions
- Finalizes daily scoring at the designated scoring hour
- Stores results in persistent storage
-
Submission Collection
_update_validators_miner_commits: Fetches commits from all validators with sufficient stake_update_miner_commits: Aggregates commits from all validators, keeping the latest versions- Maintains submission history and versioning based on commit timestamps
-
Scoring Process
_score_and_compare_new_miner_commits: Scores new submissions using challenge controllers_compare_miner_commits: Compares submissions for similarity detection- Caches scoring results for each docker_hub_id to prevent duplicate processing
- Handles both daily incremental scoring and final scoring at the designated hour
-
Storage Integration
_store_centralized_scoring: Persists scoring results to storage service_fetch_centralized_scoring: Retrieves scoring results from storage_sync_scoring_results_from_storage_to_cache: Syncs storage data to local cache- Maintains local backup in
scoring_results.json
-
API Interface
- FastAPI server running in a separate thread
/get_scoring_result: Returns scoring and comparison results for specific challenge and commits, validator can use this endpoint to get the scoring results of the miner commits- Prometheus metrics for monitoring
-
Method: POST
-
Parameters:
challenge_name: Name of the challengeencrypted_commits: List of encrypted commits to look up
-
Response:
{ "status": "success", "message": "Scoring results retrieved successfully", "data": { "commits": { "<encrypted_commit>": { "miner_uid": 123, "miner_hotkey": "...", "challenge_name": "...", "scoring_logs": [...], "comparison_logs": {...}, "score": 0.95, "penalty": 0.0 } }, "is_done": true/false } }
Setup steps for the scoring server are the same as the validator node, please refer to the validator README for more details.
python -u -m src.api \
--scoring_api.port 47920 \
--scoring_api.epoch_length 60 \
--netuid 61 \
--subtensor.network <subtensor-endpoint> \
--wallet.name <wallet-name> \
--wallet.hotkey <hotkey-name> \
--validator.cache_dir <cache-dir> \
--validator.hf_repo_id <hf-repo-id>| Argument | Description | Default |
|---|---|---|
--scoring_api.port |
Port for the FastAPI server | 47920 |
--scoring_api.epoch_length |
Processing cycle duration (seconds) | 60 |
--netuid |
Subnet ID to connect to | Required |
--subtensor.network |
Subtensor endpoint | Required |
--wallet.name |
Wallet name | Required |
--wallet.hotkey |
Wallet hotkey name | Required |
--validator.cache_dir |
Directory for caching scoring results | ./.cache |
--validator.hf_repo_id |
Hugging Face repo ID for model weights | my_username/rest-scoring-api |
Validators can use the centralized scoring service by:
- Adding the
--validator.use_centralized_scoringflag to their validator command - The validator will automatically fetch scoring results from the scoring API server
- This eliminates the need for each validator to run scoring infrastructure
- Check the Prometheus metrics endpoint for performance monitoring
- Review logs for scoring errors and processing delays
- The
scoring_results.jsonfile provides a backup of all scoring data
- If scoring results aren't being updated, check network connectivity to storage service
- Verify that the scoring API has sufficient stake in the metagraph
- Ensure the SCORING_API_HOTKEY environment variable matches the wallet.hotkey
- The scoring API has access to all validator submissions and must maintain data integrity
- Uses validation headers for secure communication with storage service
- Maintains proper synchronization between memory cache and persistent storage