Alpha burn removal & internal service helper - #143
Merged
Merged
Conversation
…lpha score methods in MinerManager
Contributor
There was a problem hiding this comment.
Pull request overview
This PR simplifies validator on-chain scoring to rely purely on aggregated challenge performance (removing alpha burn/stake components) and extends challenge comparison/validation requests to include a user_id so internal services can attribute requests to the submitting miner.
Changes:
- Simplifies
MinerManager.get_onchain_scores()to return only challenge-derived scores (with challenge-weight redistribution when some challenges have no submissions). - Adds
user_idto multiple internal-service request payloads in the challenge controller to improve submission attribution/tracking. - Updates documentation links and cleans up
redteam_core.__all__.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/redteam_core/validator/miner_manager.py | Removes alpha burn/stake influence from on-chain scores and redistributes unused challenge weights; needs doc/code cleanup. |
| src/redteam_core/challenge_pool/controller.py | Adds user_id to compare/validate payloads; reveals return-type inconsistencies that can cause runtime errors. |
| src/redteam_core/init.py | Removes stale constant_docs export from __all__. |
| README.md | Updates validator/miner documentation links to new docs paths. |
Comments suppressed due to low confidence (3)
src/redteam_core/challenge_pool/controller.py:477
- The
/compareresponse parsing defaultsdatato a list ([]), but callers expect a dict with keys likesimilarity_score/reason. If the service returns a list, this will break.get(...)usage. Parsedatadefensively and always return a dict (e.g., use{}as default and, if a list is returned, select the first element).
"user_id": user_id,
}
headers = {
"Content-Type": "application/json",
"X-API-KEY": constants.INTERNAL_SERVICES.API_KEY,
src/redteam_core/challenge_pool/controller.py:599
- The
/compare/same-scoreresponse parsing defaultsdatato[], butsame_score_comparison()treats the result as a dict (checks membership and indexes by key). Ensure_compare_same_score_outputs()always returns a dict (use{}as default and coerce list responses to a single dict).
"user_id": user_id,
}
headers = {
"Content-Type": "application/json",
"X-API-KEY": constants.INTERNAL_SERVICES.API_KEY,
src/redteam_core/validator/miner_manager.py:214
- Large blocks of commented-out scoring code (
_get_alpha_stake_scores,_get_alpha_burn_scores, and the alpha-burn fallback) are kept in the module. This makes the file harder to read/maintain and increases the risk of future confusion about which logic is active. Prefer removing these commented blocks (or moving the historical logic to documentation) now that the PR intentionally removes alpha burn/stake scoring.
# def _get_alpha_stake_scores(self, n_uids: int) -> np.ndarray:
# """
# Returns a numpy array of scores based on alpha stake, high for more stake.
# Uses square root transformation to reduce the impact of very high stakes, encourage small holders.
# """
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…and remove alpha burn details
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces several important changes, mainly focused on improving the scoring logic for miners and validators, refactoring the handling of on-chain scores, and ensuring that user identifiers are consistently included in challenge-related API calls. Additionally, it updates documentation references and makes minor cleanup changes.
Scoring Logic and On-Chain Score Calculation:
miner_manager.pyhas been simplified to rely solely on challenge scores, removing the previous weighting and fallback logic for alpha burn and alpha stake. The methods for calculating alpha burn and alpha stake scores have been removed or commented out, and the final scores now directly reflect challenge performance. [1] [2] [3]Challenge API and User Tracking:
controller.pynow consistently include theuser_id(the miner's Docker Hub ID) in their payloads. This ensures better tracking and association of submissions with users throughout the challenge lifecycle. [1] [2] [3] [4] [5] [6] [7] [8] [9]Documentation Updates:
README.mdhave been updated to point to the new locations under thedocs/validator/anddocs/miner/directories.Repository Maintenance:
flowprintsubmodule has been updated to a new commit, which may bring in upstream bugfixes or features.Code Cleanup:
__all__list inredteam_core/__init__.pyhas been cleaned up to remove a reference toconstant_docs, which no longer exists.