Skip to content

Commit 8adcdf6

Browse files
authored
fix: reapply lost PR #357 changes (#361)
1 parent 1b7f625 commit 8adcdf6

File tree

4 files changed

+7
-13
lines changed

4 files changed

+7
-13
lines changed

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/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: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ def test_github_identity_change_rejected(self, mock_validate, mock_test_query, m
150150
assert 'locked' in (result.rejection_reason or '').lower()
151151

152152
# Original entry should be unchanged
153-
entry = pat_storage.get_pat_by_uid(1) or {}
153+
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)
@@ -163,7 +164,8 @@ def test_pat_rotation_same_github_accepted(self, mock_validate, mock_test_query,
163164
result = _run(handle_pat_broadcast(mock_validator, synapse))
164165

165166
assert result.accepted is True
166-
entry = pat_storage.get_pat_by_uid(1) or {}
167+
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

@@ -177,7 +179,8 @@ def test_new_miner_on_uid_can_use_any_github(self, mock_validate, mock_test_quer
177179
result = _run(handle_pat_broadcast(mock_validator, synapse))
178180

179181
assert result.accepted is True
180-
entry = pat_storage.get_pat_by_uid(1) or {}
182+
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)