Skip to content

Commit fb9ed9b

Browse files
committed
Ensure we remain inside the status
1 parent 9dc9964 commit fb9ed9b

File tree

2 files changed

+39
-40
lines changed

2 files changed

+39
-40
lines changed

bittensor_cli/src/commands/subnets/subnets.py

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -254,50 +254,50 @@ async def _find_event_attributes_in_extrinsic_receipt(
254254
mev_protection=mev_protection,
255255
)
256256

257-
# We only wait here if we expect finalization.
258-
if not wait_for_finalization and not wait_for_inclusion:
259-
return True, None, None
257+
# We only wait here if we expect finalization.
258+
if not wait_for_finalization and not wait_for_inclusion:
259+
return True, None, None
260260

261-
if not success:
262-
err_console.print(f":cross_mark: [red]Failed[/red]: {err_msg}")
263-
return False, None, None
264-
else:
265-
# Check for MEV shield execution
266-
if mev_protection:
267-
inner_hash = err_msg
268-
mev_shield_id = await extract_mev_shield_id(response)
269-
mev_success, mev_error, response = await wait_for_extrinsic_by_hash(
270-
subtensor=subtensor,
271-
extrinsic_hash=inner_hash,
272-
shield_id=mev_shield_id,
273-
submit_block_hash=response.block_hash,
274-
status=status,
275-
)
276-
if not mev_success:
277-
status.stop()
278-
err_console.print(
279-
f":cross_mark: [red]Failed[/red]: MEV execution failed: {mev_error}"
261+
if not success:
262+
err_console.print(f":cross_mark: [red]Failed[/red]: {err_msg}")
263+
return False, None, None
264+
else:
265+
# Check for MEV shield execution
266+
if mev_protection:
267+
inner_hash = err_msg
268+
mev_shield_id = await extract_mev_shield_id(response)
269+
mev_success, mev_error, response = await wait_for_extrinsic_by_hash(
270+
subtensor=subtensor,
271+
extrinsic_hash=inner_hash,
272+
shield_id=mev_shield_id,
273+
submit_block_hash=response.block_hash,
274+
status=status,
280275
)
281-
return False, None, None
276+
if not mev_success:
277+
status.stop()
278+
err_console.print(
279+
f":cross_mark: [red]Failed[/red]: MEV execution failed: {mev_error}"
280+
)
281+
return False, None, None
282282

283-
# Successful registration, final check for membership
283+
# Successful registration, final check for membership
284284

285-
attributes = await _find_event_attributes_in_extrinsic_receipt(
286-
response, "NetworkAdded"
287-
)
288-
await print_extrinsic_id(response)
289-
ext_id = await response.get_extrinsic_identifier()
290-
if not attributes:
291-
console.print(
292-
":exclamation: [yellow]A possible error has occurred[/yellow]. The extrinsic reports success, but "
293-
"we are unable to locate the 'NetworkAdded' event inside the extrinsic's events."
294-
""
295-
)
296-
else:
297-
console.print(
298-
f":white_heavy_check_mark: [dark_sea_green3]Registered subnetwork with netuid: {attributes[0]}"
285+
attributes = await _find_event_attributes_in_extrinsic_receipt(
286+
response, "NetworkAdded"
299287
)
300-
return True, int(attributes[0]), ext_id
288+
await print_extrinsic_id(response)
289+
ext_id = await response.get_extrinsic_identifier()
290+
if not attributes:
291+
console.print(
292+
":exclamation: [yellow]A possible error has occurred[/yellow]. The extrinsic reports success, but "
293+
"we are unable to locate the 'NetworkAdded' event inside the extrinsic's events."
294+
""
295+
)
296+
else:
297+
console.print(
298+
f":white_heavy_check_mark: [dark_sea_green3]Registered subnetwork with netuid: {attributes[0]}"
299+
)
300+
return True, int(attributes[0]), ext_id
301301

302302

303303
# commands

tests/e2e_tests/test_unstaking.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ def test_unstaking(local_chain, wallet_setup):
8989
"--no-prompt",
9090
],
9191
)
92-
print(result.stdout, result.stderr)
9392
assert "✅ Registered subnetwork with netuid: 2" in result.stdout
9493
assert "Your extrinsic has been included" in result.stdout, result.stdout
9594

0 commit comments

Comments
 (0)