File tree Expand file tree Collapse file tree 2 files changed +40
-3
lines changed
bittensor_cli/src/commands/stake Expand file tree Collapse file tree 2 files changed +40
-3
lines changed Original file line number Diff line number Diff line change @@ -493,9 +493,19 @@ async def stake_extrinsic(
493493 price_idx = 0
494494 for hotkey in hotkeys_to_stake_to :
495495 for netuid in netuids :
496+ # Safety check: if we've processed all items from the first loop, stop
496497 if list_idx >= len (amounts_to_stake ):
497498 break
498499
500+ # Verify subnet exists (same check as first loop)
501+ # If subnet doesn't exist, it was skipped in first loop, so list_idx won't advance
502+ # We need to skip it here too to stay in sync
503+ subnet_info = all_subnets .get (netuid )
504+ if not subnet_info :
505+ # This netuid was skipped in first loop (doesn't exist)
506+ # Don't advance list_idx, just continue to next netuid
507+ continue
508+
499509 am = amounts_to_stake [list_idx ]
500510 curr = current_stake_balances [list_idx ]
501511 staking_address = hotkey [1 ]
Original file line number Diff line number Diff line change @@ -192,6 +192,33 @@ def test_batching(local_chain, wallet_setup):
192192 register_result .stdout
193193 )
194194
195+ # Register Bob in one subnet
196+ register_result_subnet3 = exec_command_bob (
197+ command = "subnets" ,
198+ sub_command = "register" ,
199+ extra_args = [
200+ "--netuid" ,
201+ "3" ,
202+ "--wallet-path" ,
203+ wallet_path_bob ,
204+ "--wallet-name" ,
205+ wallet_bob .name ,
206+ "--hotkey" ,
207+ wallet_bob .hotkey_str ,
208+ "--chain" ,
209+ "ws://127.0.0.1:9945" ,
210+ "--no-prompt" ,
211+ "--era" ,
212+ "30" ,
213+ ],
214+ )
215+ assert "✅ Registered" in register_result_subnet3 .stdout , (
216+ register_result_subnet3 .stderr
217+ )
218+ assert "Your extrinsic has been included" in register_result_subnet3 .stdout , (
219+ register_result_subnet3 .stdout
220+ )
221+
195222 # Add stake to subnets
196223 multiple_netuids = [2 , 3 ]
197224 stake_result = exec_command_bob (
@@ -211,9 +238,7 @@ def test_batching(local_chain, wallet_setup):
211238 "--chain" ,
212239 "ws://127.0.0.1:9945" ,
213240 "--no-prompt" ,
214- "--partial" ,
215- "--tolerance" ,
216- "1.0" , # Increased from 0.5 to 1.0 (100% tolerance) to handle price volatility in pipeline
241+ "--unsafe" ,
217242 "--era" ,
218243 "144" ,
219244 ],
@@ -223,6 +248,8 @@ def test_batching(local_chain, wallet_setup):
223248 stake_result .stdout
224249 )
225250
251+ print (f"output: { stake_result .stdout } " )
252+
226253 # Verify extrinsic_id is unique (all operations should share the same extrinsic_id when batched)
227254 # Pattern matches: "Your extrinsic has been included as {block_number}-{extrinsic_index}"
228255 extrinsic_id_pattern = r"Your extrinsic has been included as (\d+-\d+)"
You can’t perform that action at this time.
0 commit comments