Skip to content

Commit cc46870

Browse files
Burn weights on mechanism 0
1 parent 913cfc6 commit cc46870

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

  • app/src/infinite_hashes/validator

app/src/infinite_hashes/validator/tasks.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,9 @@ async def set_weights_async() -> bool:
348348

349349
# Query neurons at current block, not historical validation block
350350
# (We can't go back in time for neuron state)
351-
neurons = {neuron.hotkey: neuron for neuron in await subnet.list_neurons()}
351+
neuron_list = await subnet.list_neurons()
352+
neurons = {neuron.hotkey: neuron for neuron in neuron_list}
353+
neurons_by_uid = {neuron.uid: neuron for neuron in neuron_list}
352354

353355
weights_by_uid = collections.defaultdict[int, float](float)
354356

@@ -364,7 +366,22 @@ async def set_weights_async() -> bool:
364366
batch.scored = True
365367

366368
if not weights_by_uid:
367-
return False
369+
burn_uid = await get_burn_uid(bittensor, settings.BITTENSOR_NETUID, neuron_list)
370+
try:
371+
burn_uid_int = int(burn_uid) if burn_uid is not None else None
372+
except (TypeError, ValueError):
373+
burn_uid_int = None
374+
375+
if burn_uid_int is None:
376+
logger.warning("No weights from Luxor and no burn UID available; skipping weight setting")
377+
return False
378+
379+
if burn_uid_int not in neurons_by_uid:
380+
logger.warning("Burn UID not found in current neuron set; skipping weight setting", burn_uid=burn_uid_int)
381+
return False
382+
383+
weights_by_uid[burn_uid_int] = 1.0
384+
logger.info("No Luxor weights; assigning full weight to burn UID", burn_uid=burn_uid_int)
368385

369386
# Note: subnet.weights.commit() handles u16 normalization and commit/reveal internally
370387
# This is turbobt's high-level API for mechanism 0 (backward compatibility)

0 commit comments

Comments
 (0)