Skip to content

feat(scoring): hard-zero credibility above the timeout limit#435

Open
anderdc wants to merge 1 commit into
testfrom
feat/credibility-zero-on-excess-timeouts
Open

feat(scoring): hard-zero credibility above the timeout limit#435
anderdc wants to merge 1 commit into
testfrom
feat/credibility-zero-on-excess-timeouts

Conversation

@anderdc
Copy link
Copy Markdown
Collaborator

@anderdc anderdc commented May 30, 2026

What

Adds a rolling-window hard floor on miner credibility: more than CREDIBILITY_MAX_TIMEOUTS (3) timed-out swaps within CREDIBILITY_WINDOW_BLOCKS (~30d) forces the credibility ramp to 0 — which, since ramp is a multiplicand in crown × cap × vol × rate³ × ramp, zeros the miner's whole reward for the round.

Why

Previously the credibility ramp only ever ramped up: credibility_ramp() returned min(1.0, closed_swaps / 10), and a timeout counted toward the ramp as just another observation. So a high-volume miner could rack up many timeouts and still earn a 1.00× credibility multiplier — the only penalty lived in the cubed success_rate term. We want repeated timeouts to be disqualifying, not merely dilutive.

Behavior

  • 0–3 timeouts in the window: tolerated (ramp unchanged).
  • 4th timeout: credibility → 0 (reward → 0).
  • Rolling / auto-recover: credibility returns once old timeouts age out of the 30-day window and the count drops back to ≤3. No new persistent state.

Changes

  • constants.py: new CREDIBILITY_MAX_TIMEOUTS = 3.
  • scoring.py: credibility_ramp() returns 0.0 when timed_out > CREDIBILITY_MAX_TIMEOUTS.
  • scoring_trace.py: record_credibility() mirrors the zero so the validator's own stdout log is honest.
  • Tests: updated the two assertions that encoded the old "timeouts advance ramp" behavior; added boundary + integration coverage ((8,3)→full, (8,4)→0, 5+5 swaps → reward 0). pytest tests/test_scoring_v1.py → 127 passed.

Related (must land together)

This is the source-of-truth change. The dashboard mirror + UI display land alongside:

A miner's credibility ramp previously only ever ramped up — timeouts
counted toward it as observations, so a high-volume miner could rack up
many timeouts and still earn a 1.00x credibility multiplier, with the
only penalty living in the cubed success-rate term.

Add a rolling-window hard floor: more than CREDIBILITY_MAX_TIMEOUTS (3)
timed-out swaps within CREDIBILITY_WINDOW_BLOCKS zeros credibility (and
thus the whole reward) until the old timeouts age out of the window.
The scoring trace mirrors the zero so the validator's own log is honest.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant