Skip to content

fix: return neutral speed score for miners with no timing data, remove dead all_chains#39

Open
Grizouforever wants to merge 1 commit intoentrius:testfrom
Grizouforever:fix/zero-speed-score-completed-swaps
Open

fix: return neutral speed score for miners with no timing data, remove dead all_chains#39
Grizouforever wants to merge 1 commit intoentrius:testfrom
Grizouforever:fix/zero-speed-score-completed-swaps

Conversation

@Grizouforever
Copy link
Copy Markdown

Closes #38

Summary

  • _chain_weighted_speed returned 0.0 when total_swaps == 0, which collapsed success_rate * volume_weight * speed_score to zero for any miner whose completed swaps all had fulfilled_block == 0 (no timing recorded). Fix returns 1.0 (neutral baseline) when total_swaps == 0 but s.completed > 0.
  • Remove dead all_chains: set variable (populated in the loop, never consumed).

Changes

allways/validator/forward.py:

  • _chain_weighted_speed: add fallback return 1.0 branch when no timing data exists but s.completed > 0
  • calculate_miner_rewards: remove unused all_chains variable and its all_chains.add(chain) call

Testing

All 139 existing tests pass (uv run pytest).

@anderdc @LandynDev

…e dead all_chains

Miners whose completed swaps all have fulfilled_block == 0 get no
fulfillment timing recorded, causing _chain_weighted_speed to return 0.0
and zeroing out their full reward despite successful completions.

- Return 1.0 (neutral baseline) from _chain_weighted_speed when
  total_swaps == 0 but s.completed > 0, so timing-less completions are
  scored at parity rather than annihilated.
- Remove the all_chains: set variable that was populated but never read
  (dead code introduced alongside avg_speeds_by_chain).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

Miners with completed swaps but no fulfillment timing receive zero reward

1 participant