fix: route all weight to recycle_uid when subnet price fetch fails#41
Open
Grizouforever wants to merge 1 commit intoentrius:testfrom
Open
fix: route all weight to recycle_uid when subnet price fetch fails#41Grizouforever wants to merge 1 commit intoentrius:testfrom
Grizouforever wants to merge 1 commit intoentrius:testfrom
Conversation
Previously apply_recycle returned (rewards, uids) unchanged when
get_subnet_price raised an exception. Because rewards starts as all
zeros (from calculate_miner_rewards when there is nothing to score, or
as real values that have not yet been recycled), this caused
update_scores to be called with the original all-zero rewards and no
recycle entry, silently dropping one full scoring round's emission.
Fall back to returning ([1.0], {recycle_uid}) — the same behaviour used
when no miners are scored — so emissions are recycled rather than lost.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #40
Summary
apply_recyclepreviously returned(rewards, uids)unchanged whenget_subnet_priceraised an exception. Becauserewardsat that point contains the raw miner scores (which sum to ≤ 1.0 but excluderecycle_uid), callingupdate_scoreswith those values silently drops the recycled portion for that round — emissions are neither paid to miners nor recycled.The fix falls back to
(np.array([1.0]), {recycle_uid}), identical to the "no miners scored" path, ensuring emissions are always recycled rather than lost.Changes
allways/validator/recycle.py:get_subnet_priceexception, return([1.0], {recycle_uid})instead of the unchanged(rewards, uids)Testing
All 139 existing tests pass (
uv run pytest).@anderdc @LandynDev