Skip to content

Commit ea67867

Browse files
committed
simplify few things
1 parent 476a39a commit ea67867

1 file changed

Lines changed: 6 additions & 22 deletions

File tree

subvortex/validator/neuron/src/challenge.py

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -250,27 +250,13 @@ async def create_subtensor_challenge(subtensor: btcs.Subtensor):
250250
params=[f"NeuronInfoRuntimeApi_get_neuron_lite", params, block_hash],
251251
)
252252

253-
# Get the result
254-
value = response.get("result")
255-
256253
# Decode the result
257-
try:
258-
result = decode(substrate=subtensor.substrate, result=response.get("result"))
259-
except Exception as ex:
260-
btul.logging.error(f"Failed to decode challenge creation result: {ex}")
261-
return None
254+
result = decode(substrate=subtensor.substrate, result=response.get("result"))
262255

263256
# Get the property value
264-
try:
265-
property_value = result.get(property_name)
266-
if property_value is None:
267-
btul.logging.error(f"Property '{property_name}' not found in result. Available: {list(result.keys())}")
268-
return None
269-
except Exception as ex:
270-
btul.logging.error(f"Failed to extract property '{property_name}': {ex}")
271-
return None
257+
propert_value = result.get(property_name)
272258

273-
return (block_hash, params, value, property_name, property_value, result)
259+
return (block_hash, params, property_name, propert_value)
274260

275261
except Exception as err:
276262
btul.logging.warning(f"Could not create the challenge: {err}")
@@ -326,9 +312,7 @@ def challenge_subtensor(
326312
for attempt in range(max_retries):
327313
try:
328314
# Get the details of the challenge
329-
block_hash, params, value, property_name, property_value, final_value = (
330-
challenge
331-
)
315+
block_hash, params, property_name, property_value = challenge
332316

333317
# Add small delay between retries
334318
if attempt > 0:
@@ -379,7 +363,7 @@ def challenge_subtensor(
379363
],
380364
}
381365
)
382-
366+
383367
try:
384368
# Send request
385369
ws.send(data)
@@ -561,7 +545,7 @@ async def challenge_data(self, block: int):
561545
return
562546

563547
btul.logging.debug(
564-
f"[{CHALLENGE_NAME}] Challenge created - Block: {challenge[0]}, Params: {challenge[1]}, Value: {challenge[2]}"
548+
f"[{CHALLENGE_NAME}] Challenge created - Block: {challenge[0]}, Params: {challenge[1]}, Name: {challenge[2]}, Value: {challenge[3]}"
565549
)
566550

567551
# Select the miners

0 commit comments

Comments
 (0)