Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gittensor/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
# Eligibility Gate (OSS Contributions)
# =============================================================================
MIN_VALID_MERGED_PRS = 5 # minimum "valid" merged PRs (token_score >= MIN_TOKEN_SCORE_FOR_BASE_SCORE) to receive score
MIN_CREDIBILITY = 0.90 # minimum credibility ratio to receive score
MIN_CREDIBILITY = 0.80 # minimum credibility ratio to receive score
CREDIBILITY_MULLIGAN_COUNT = 1 # number of closed PRs forgiven (erased from merged+closed counts entirely)

# =============================================================================
Expand Down
4 changes: 2 additions & 2 deletions gittensor/validator/pat_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ def _reject(reason: str) -> PatBroadcastSynapse:
if test_error:
return _reject(f'PAT test query failed: {test_error}')

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

# Clear PAT from response so it isn't echoed back
synapse.github_access_token = ''
Expand Down
7 changes: 0 additions & 7 deletions gittensor/validator/storage/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,6 @@
AND created_at <= %s
"""

CLEANUP_STALE_MINER_TIER_STATS_BY_HOTKEY = """
DELETE FROM miner_tier_stats
WHERE uid = %s AND hotkey = %s
AND github_id != %s
AND github_id != '0'
"""

CLEANUP_STALE_MINERS_BY_HOTKEY = """
DELETE FROM miners
WHERE uid = %s AND hotkey = %s
Expand Down
2 changes: 0 additions & 2 deletions gittensor/validator/storage/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
BULK_UPSERT_PULL_REQUESTS,
CLEANUP_STALE_MINER_EVALUATIONS,
CLEANUP_STALE_MINER_EVALUATIONS_BY_HOTKEY,
CLEANUP_STALE_MINER_TIER_STATS_BY_HOTKEY,
CLEANUP_STALE_MINERS,
CLEANUP_STALE_MINERS_BY_HOTKEY,
SET_MINER,
Expand Down Expand Up @@ -134,7 +133,6 @@ def cleanup_stale_miner_data(self, evaluation: MinerEvaluation) -> None:
reverse_params = (evaluation.uid, evaluation.hotkey, evaluation.github_id)
reverse_eval_params = reverse_params + (evaluation.evaluation_timestamp,)
self.execute_command(CLEANUP_STALE_MINER_EVALUATIONS_BY_HOTKEY, reverse_eval_params)
self.execute_command(CLEANUP_STALE_MINER_TIER_STATS_BY_HOTKEY, reverse_params)
self.execute_command(CLEANUP_STALE_MINERS_BY_HOTKEY, reverse_params)

def store_pull_requests_bulk(self, pull_requests: List[PullRequest]) -> int:
Expand Down
3 changes: 3 additions & 0 deletions tests/validator/test_pat_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ def test_github_identity_change_rejected(self, mock_validate, mock_test_query, m

# Original entry should be unchanged
entry = pat_storage.get_pat_by_uid(1)
assert entry is not None
assert entry['github_id'] == 'github_42'

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

assert result.accepted is True
entry = pat_storage.get_pat_by_uid(1)
assert entry is not None
assert entry['pat'] == 'ghp_refreshed'
assert entry['github_id'] == 'github_42'

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

assert result.accepted is True
entry = pat_storage.get_pat_by_uid(1)
assert entry is not None
assert entry['github_id'] == 'github_99'
assert entry['hotkey'] == 'hotkey_1'

Expand Down
Loading