feat(rewards): allocate emissions by repository share#1235
Conversation
a0f06d5 to
4f496d7
Compare
|
@anderdc can you please review my pr and let me know your feedback? |
anderdc
left a comment
There was a problem hiding this comment.
Two blockers for #1215:
-
Case-sens: forward.py _collect_repo_pr_scores / _collect_repo_issue_discovery_scores — use
pr.repository_full_name.lower() == repo_nameandissue.repository_full_name.lower() == repo_name. The loader normalizes registry keys to lowercase (load_weights.py:147) but live PR/issue data preserves GitHub case, so the current comparison silently misses any mixed-case repo. -
Out of scope: forward.py _collect_repo_pr_scores — drop the
score = max(0.0, earned - collateral)subtraction and the matching test_open_pr_collateral_reduces_pr_side_score_in_same_repo. The spec asks for distribution by per-PR earned score; net-of-collateral is a separate scoring change.
|
@anderdc just pushed the changes, can you please review again? |
anderdc
left a comment
There was a problem hiding this comment.
Storage compat retention is the last blocker. ScoredPR.repo_weight_multiplier (classes.py:185) and Issue.discovery_repo_weight_multiplier (classes.py:153) are now write-only at neutral 1.0 — nothing reads them for scoring, the breakdown surface already drops them via _PR_SKIP, and resolve_repo_weight was deleted. Drop the dead fields in this PR so deliverable #7 ships atomically: (1) remove both fields from the dataclasses in classes.py; (2) drop repo_weight_multiplier=scored.repo_weight_multiplier, from adapters.py:119; (3) drop the repo_weight_multiplier column + DO UPDATE SET clause from BULK_UPSERT_PULL_REQUESTS and the discovery_repo_weight_multiplier column + clause from BULK_UPSERT_ISSUES in queries.py:48,74,120,145; (4) drop the param bindings at repository.py:180,277; (5) remove the tests that assert scored.repo_weight_multiplier == 1.0. The DB columns can stay dormant — a follow-up in gittensor-db drops the columns once validators are migrated. With that done the PR hits all 11 deliverables.
addressed the comments and pushed the update again |
Summary
weightmultiplier into boundedemission_sharepool slicing at round aggregation.gittensor/validator/emission_allocation.py, withforward.pyonly orchestrating the validator cycle.issue_discovery_shareallocation with same-repo PR/issue spill in both directions and recycle-only slack behavior.Issueobjects on miner evaluations so allocation uses repo-local discovery evidence.master_repositories.jsonto emission shares, fail loudly on registry invariant violations, and document the emission-share model.Diff scope note: this PR is 29 files / +797 / -338 because it includes allocator extraction, removal of now-orphaned normalize modules, dead scoring-plumbing cleanup, README alignment, registry migration, and comprehensive regression coverage. The core allocation logic is isolated in
gittensor/validator/emission_allocation.py; the rest is compatibility cleanup and tests.Storage compatibility note: the validator no longer carries or writes
repo_weight_multiplier/discovery_repo_weight_multiplierfields. Existing DB columns are intentionally left dormant so this code PR does not require a coordinated database-schema rollout; a follow-up ingittensor-dbcan drop the columns once validators are migrated.Related Issues
Closes #1215
Type of Change
Emission policy / reward allocation change.
Testing
Commands run:
Results:
140 passed89 passed753 passedChecklist