Skip to content

Commit 6ca2c5b

Browse files
authored
Remove stale miner_tier_stats reference (#357)
1 parent 95d7d05 commit 6ca2c5b

5 files changed

Lines changed: 6 additions & 12 deletions

File tree

gittensor/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
# Eligibility Gate (OSS Contributions)
105105
# =============================================================================
106106
MIN_VALID_MERGED_PRS = 5 # minimum "valid" merged PRs (token_score >= MIN_TOKEN_SCORE_FOR_BASE_SCORE) to receive score
107-
MIN_CREDIBILITY = 0.90 # minimum credibility ratio to receive score
107+
MIN_CREDIBILITY = 0.80 # minimum credibility ratio to receive score
108108
CREDIBILITY_MULLIGAN_COUNT = 1 # number of closed PRs forgiven (erased from merged+closed counts entirely)
109109

110110
# =============================================================================

gittensor/validator/pat_handler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ def _reject(reason: str) -> PatBroadcastSynapse:
6666
if test_error:
6767
return _reject(f'PAT test query failed: {test_error}')
6868

69-
# 5. Store PAT
70-
pat_storage.save_pat(uid=uid, hotkey=hotkey, pat=synapse.github_access_token, github_id=github_id)
69+
# 5. Store PAT (github_id guaranteed non-None after validate_github_credentials success)
70+
pat_storage.save_pat(uid=uid, hotkey=hotkey, pat=synapse.github_access_token, github_id=github_id or '0')
7171

7272
# Clear PAT from response so it isn't echoed back
7373
synapse.github_access_token = ''

gittensor/validator/storage/queries.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,6 @@
2525
AND created_at <= %s
2626
"""
2727

28-
CLEANUP_STALE_MINER_TIER_STATS_BY_HOTKEY = """
29-
DELETE FROM miner_tier_stats
30-
WHERE uid = %s AND hotkey = %s
31-
AND github_id != %s
32-
AND github_id != '0'
33-
"""
34-
3528
CLEANUP_STALE_MINERS_BY_HOTKEY = """
3629
DELETE FROM miners
3730
WHERE uid = %s AND hotkey = %s

gittensor/validator/storage/repository.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
BULK_UPSERT_PULL_REQUESTS,
2222
CLEANUP_STALE_MINER_EVALUATIONS,
2323
CLEANUP_STALE_MINER_EVALUATIONS_BY_HOTKEY,
24-
CLEANUP_STALE_MINER_TIER_STATS_BY_HOTKEY,
2524
CLEANUP_STALE_MINERS,
2625
CLEANUP_STALE_MINERS_BY_HOTKEY,
2726
SET_MINER,
@@ -134,7 +133,6 @@ def cleanup_stale_miner_data(self, evaluation: MinerEvaluation) -> None:
134133
reverse_params = (evaluation.uid, evaluation.hotkey, evaluation.github_id)
135134
reverse_eval_params = reverse_params + (evaluation.evaluation_timestamp,)
136135
self.execute_command(CLEANUP_STALE_MINER_EVALUATIONS_BY_HOTKEY, reverse_eval_params)
137-
self.execute_command(CLEANUP_STALE_MINER_TIER_STATS_BY_HOTKEY, reverse_params)
138136
self.execute_command(CLEANUP_STALE_MINERS_BY_HOTKEY, reverse_params)
139137

140138
def store_pull_requests_bulk(self, pull_requests: List[PullRequest]) -> int:

tests/validator/test_pat_handler.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ def test_github_identity_change_rejected(self, mock_validate, mock_test_query, m
151151

152152
# Original entry should be unchanged
153153
entry = pat_storage.get_pat_by_uid(1)
154+
assert entry is not None
154155
assert entry['github_id'] == 'github_42'
155156

156157
@patch('gittensor.validator.pat_handler._test_pat_against_repo', return_value=None)
@@ -164,6 +165,7 @@ def test_pat_rotation_same_github_accepted(self, mock_validate, mock_test_query,
164165

165166
assert result.accepted is True
166167
entry = pat_storage.get_pat_by_uid(1)
168+
assert entry is not None
167169
assert entry['pat'] == 'ghp_refreshed'
168170
assert entry['github_id'] == 'github_42'
169171

@@ -178,6 +180,7 @@ def test_new_miner_on_uid_can_use_any_github(self, mock_validate, mock_test_quer
178180

179181
assert result.accepted is True
180182
entry = pat_storage.get_pat_by_uid(1)
183+
assert entry is not None
181184
assert entry['github_id'] == 'github_99'
182185
assert entry['hotkey'] == 'hotkey_1'
183186

0 commit comments

Comments
 (0)