From d4f2767e8c2f72c10cb449b95337875aa25cfe5e Mon Sep 17 00:00:00 2001 From: Roman Date: Thu, 7 Aug 2025 17:16:03 -0700 Subject: [PATCH 01/12] `add_stake` -> `add_stake_aggregate` --- bittensor/core/extrinsics/asyncex/staking.py | 6 +++--- bittensor/core/extrinsics/staking.py | 4 ++-- tests/unit_tests/extrinsics/test_staking.py | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bittensor/core/extrinsics/asyncex/staking.py b/bittensor/core/extrinsics/asyncex/staking.py index 76ffe73285..0f19688f3c 100644 --- a/bittensor/core/extrinsics/asyncex/staking.py +++ b/bittensor/core/extrinsics/asyncex/staking.py @@ -144,14 +144,14 @@ async def add_stake_extrinsic( "allow_partial": allow_partial_stake, } ) - call_function = "add_stake_limit" + call_function = "add_stake_limit_aggregate" else: logging.info( f":satellite: [magenta]Staking to:[/magenta] " f"[blue]netuid: [green]{netuid}[/green], amount: [green]{staking_balance}[/green] " f"on [blue]{subtensor.network}[/blue][magenta]...[/magenta]" ) - call_function = "add_stake" + call_function = "add_stake_aggregate" call = await subtensor.substrate.compose_call( call_module="SubtensorModule", @@ -346,7 +346,7 @@ async def add_stake_multiple_extrinsic( ) call = await subtensor.substrate.compose_call( call_module="SubtensorModule", - call_function="add_stake", + call_function="add_stake_aggregate", call_params={ "hotkey": hotkey_ss58, "amount_staked": staking_balance.rao, diff --git a/bittensor/core/extrinsics/staking.py b/bittensor/core/extrinsics/staking.py index fc8b69c48b..78b28e8cdd 100644 --- a/bittensor/core/extrinsics/staking.py +++ b/bittensor/core/extrinsics/staking.py @@ -143,7 +143,7 @@ def add_stake_extrinsic( f"[blue]netuid: [green]{netuid}[/green], amount: [green]{staking_balance}[/green] " f"on [blue]{subtensor.network}[/blue][magenta]...[/magenta]" ) - call_function = "add_stake" + call_function = "add_stake_aggregate" call = subtensor.substrate.compose_call( call_module="SubtensorModule", @@ -328,7 +328,7 @@ def add_stake_multiple_extrinsic( ) call = subtensor.substrate.compose_call( call_module="SubtensorModule", - call_function="add_stake", + call_function="add_stake_aggregate", call_params={ "hotkey": hotkey_ss58, "amount_staked": staking_balance.rao, diff --git a/tests/unit_tests/extrinsics/test_staking.py b/tests/unit_tests/extrinsics/test_staking.py index 80ecb5c240..0373b6eb37 100644 --- a/tests/unit_tests/extrinsics/test_staking.py +++ b/tests/unit_tests/extrinsics/test_staking.py @@ -40,7 +40,7 @@ def test_add_stake_extrinsic(mocker): fake_subtensor.substrate.compose_call.assert_called_once_with( call_module="SubtensorModule", - call_function="add_stake", + call_function="add_stake_aggregate", call_params={"hotkey": "hotkey", "amount_staked": 9, "netuid": 1}, ) fake_subtensor.sign_and_send_extrinsic.assert_called_once_with( @@ -115,7 +115,7 @@ def test_add_stake_multiple_extrinsic(mocker): fake_subtensor.substrate.compose_call.assert_any_call( call_module="SubtensorModule", - call_function="add_stake", + call_function="add_stake_aggregate", call_params={ "hotkey": "hotkey2", "amount_staked": 2199999333, @@ -124,7 +124,7 @@ def test_add_stake_multiple_extrinsic(mocker): ) fake_subtensor.substrate.compose_call.assert_any_call( call_module="SubtensorModule", - call_function="add_stake", + call_function="add_stake_aggregate", call_params={ "hotkey": "hotkey2", "amount_staked": 2199999333, From d32970914afc2d99ebeafbe385ed6f2a342476d0 Mon Sep 17 00:00:00 2001 From: Roman Date: Thu, 7 Aug 2025 18:08:31 -0700 Subject: [PATCH 02/12] `remove_stake_full_limit` -> `remove_stake_full_limit_aggregate`, `remove_stake` -> `remove_stake_aggregate` --- bittensor/core/extrinsics/asyncex/unstaking.py | 8 ++++---- bittensor/core/extrinsics/unstaking.py | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bittensor/core/extrinsics/asyncex/unstaking.py b/bittensor/core/extrinsics/asyncex/unstaking.py index f5721cd59f..357cd7ee69 100644 --- a/bittensor/core/extrinsics/asyncex/unstaking.py +++ b/bittensor/core/extrinsics/asyncex/unstaking.py @@ -131,14 +131,14 @@ async def unstake_extrinsic( "allow_partial": allow_partial_stake, } ) - call_function = "remove_stake_limit" + call_function = "remove_stake_limit_aggregate" else: logging.info( f":satellite: [magenta]Unstaking from:[/magenta] " f"netuid: [green]{netuid}[/green], amount: [green]{unstaking_balance}[/green] " f"on [blue]{subtensor.network}[/blue][magenta]...[/magenta]" ) - call_function = "remove_stake" + call_function = "remove_stake_aggregate" call = await subtensor.substrate.compose_call( call_module="SubtensorModule", @@ -251,7 +251,7 @@ async def unstake_all_extrinsic( async with subtensor.substrate as substrate: call = await substrate.compose_call( call_module="SubtensorModule", - call_function="remove_stake_full_limit", + call_function="remove_stake_full_limit_aggregate", call_params=call_params, ) @@ -387,7 +387,7 @@ async def unstake_multiple_extrinsic( ) call = await subtensor.substrate.compose_call( call_module="SubtensorModule", - call_function="remove_stake", + call_function="remove_stake_aggregate", call_params={ "hotkey": hotkey_ss58, "amount_unstaked": unstaking_balance.rao, diff --git a/bittensor/core/extrinsics/unstaking.py b/bittensor/core/extrinsics/unstaking.py index beff7f1993..29436cc7db 100644 --- a/bittensor/core/extrinsics/unstaking.py +++ b/bittensor/core/extrinsics/unstaking.py @@ -136,7 +136,7 @@ def unstake_extrinsic( f"netuid: [green]{netuid}[/green], amount: [green]{unstaking_balance}[/green] " f"on [blue]{subtensor.network}[/blue][magenta]...[/magenta]" ) - call_function = "remove_stake" + call_function = "remove_stake_aggregate" call = subtensor.substrate.compose_call( call_module="SubtensorModule", @@ -247,7 +247,7 @@ def unstake_all_extrinsic( call = subtensor.substrate.compose_call( call_module="SubtensorModule", - call_function="remove_stake_full_limit", + call_function="remove_stake_full_limit_aggregate", call_params=call_params, ) @@ -377,7 +377,7 @@ def unstake_multiple_extrinsic( ) call = subtensor.substrate.compose_call( call_module="SubtensorModule", - call_function="remove_stake", + call_function="remove_stake_aggregate", call_params={ "hotkey": hotkey_ss58, "amount_unstaked": unstaking_balance.rao, From 335cd220f6492356d2bac3af0a8f63fa5ba12478 Mon Sep 17 00:00:00 2001 From: Roman Date: Thu, 7 Aug 2025 18:08:39 -0700 Subject: [PATCH 03/12] oops --- bittensor/core/extrinsics/staking.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bittensor/core/extrinsics/staking.py b/bittensor/core/extrinsics/staking.py index 78b28e8cdd..a9228b9a5a 100644 --- a/bittensor/core/extrinsics/staking.py +++ b/bittensor/core/extrinsics/staking.py @@ -136,7 +136,7 @@ def add_stake_extrinsic( "allow_partial": allow_partial_stake, } ) - call_function = "add_stake_limit" + call_function = "add_stake_limit_aggregate" else: logging.info( f":satellite: [magenta]Staking to:[/magenta] " From 8517fc820fd9e115c35ff5b48dccad2528ae659e Mon Sep 17 00:00:00 2001 From: Roman Date: Thu, 7 Aug 2025 18:08:44 -0700 Subject: [PATCH 04/12] fix tests --- tests/e2e_tests/test_staking.py | 102 +++++++++--------- .../extrinsics/asyncex/test_unstaking.py | 8 +- tests/unit_tests/extrinsics/test_unstaking.py | 15 +-- 3 files changed, 58 insertions(+), 67 deletions(-) diff --git a/tests/e2e_tests/test_staking.py b/tests/e2e_tests/test_staking.py index 086c570490..7553894de3 100644 --- a/tests/e2e_tests/test_staking.py +++ b/tests/e2e_tests/test_staking.py @@ -78,7 +78,7 @@ def test_single_operation(subtensor, alice_wallet, bob_wallet): logging.console.info(f"Bob stake: {stake_bob}") assert stake_bob > Balance(0).set_unit(alice_subnet_netuid) - stakes = subtensor.get_stake_for_coldkey(alice_wallet.coldkey.ss58_address) + stakes = subtensor.get_stake_for_coldkey(coldkey_ss58=alice_wallet.coldkey.ss58_address) expected_stakes = [ StakeInfo( @@ -118,8 +118,8 @@ def test_single_operation(subtensor, alice_wallet, bob_wallet): assert subtensor.get_stake_for_coldkey == subtensor.get_stake_info_for_coldkey stakes = subtensor.get_stake_for_coldkey_and_hotkey( - alice_wallet.coldkey.ss58_address, - bob_wallet.hotkey.ss58_address, + coldkey_ss58=alice_wallet.coldkey.ss58_address, + hotkey_ss58=bob_wallet.hotkey.ss58_address, ) assert stakes == { @@ -194,7 +194,7 @@ def test_batch_operations(subtensor, alice_wallet, bob_wallet): for _ in netuids: subtensor.register_subnet( - alice_wallet, + wallet=alice_wallet, wait_for_inclusion=True, wait_for_finalization=True, ) @@ -205,16 +205,16 @@ def test_batch_operations(subtensor, alice_wallet, bob_wallet): for netuid in netuids: subtensor.burned_register( - bob_wallet, - netuid, + wallet=bob_wallet, + netuid=netuid, wait_for_inclusion=True, wait_for_finalization=True, ) for netuid in netuids: stake = subtensor.get_stake( - alice_wallet.coldkey.ss58_address, - bob_wallet.hotkey.ss58_address, + coldkey_ss58=alice_wallet.coldkey.ss58_address, + hotkey_ss58=bob_wallet.hotkey.ss58_address, netuid=netuid, ) @@ -322,33 +322,33 @@ def test_safe_staking_scenarios(subtensor, alice_wallet, bob_wallet): 2. Succeeds with strict threshold (0.5%) and partial staking allowed 3. Succeeds with lenient threshold (10% and 30%) and no partial staking """ - alice_subnet_netuid = subtensor.get_total_subnets() # 2 + alice_subnet_netuid = subtensor.subnets.get_total_subnets() # 2 # Register root as Alice - the subnet owner and validator - assert subtensor.register_subnet(alice_wallet, True, True) + assert subtensor.subnets.register_subnet(alice_wallet, True, True) # Verify subnet created successfully - assert subtensor.subnet_exists(alice_subnet_netuid), ( + assert subtensor.subnets.subnet_exists(alice_subnet_netuid), ( "Subnet wasn't created successfully" ) assert wait_to_start_call(subtensor, alice_wallet, alice_subnet_netuid) - subtensor.burned_register( - alice_wallet, + subtensor.extrinsics.burned_register( + wallet=alice_wallet, netuid=alice_subnet_netuid, wait_for_inclusion=True, wait_for_finalization=True, ) - subtensor.burned_register( - bob_wallet, + subtensor.extrinsics.burned_register( + wallet=bob_wallet, netuid=alice_subnet_netuid, wait_for_inclusion=True, wait_for_finalization=True, ) - initial_stake = subtensor.get_stake( - alice_wallet.coldkey.ss58_address, - bob_wallet.hotkey.ss58_address, + initial_stake = subtensor.staking.get_stake( + coldkey_ss58=alice_wallet.coldkey.ss58_address, + hotkey_ss58=bob_wallet.hotkey.ss58_address, netuid=alice_subnet_netuid, ) assert initial_stake == Balance(0).set_unit(alice_subnet_netuid) @@ -357,9 +357,9 @@ def test_safe_staking_scenarios(subtensor, alice_wallet, bob_wallet): stake_amount = Balance.from_tao(100) # 1. Strict params - should fail - success = subtensor.add_stake( - alice_wallet, - bob_wallet.hotkey.ss58_address, + success = subtensor.staking.add_stake( + wallet=alice_wallet, + hotkey_ss58=bob_wallet.hotkey.ss58_address, netuid=alice_subnet_netuid, amount=stake_amount, wait_for_inclusion=True, @@ -370,9 +370,9 @@ def test_safe_staking_scenarios(subtensor, alice_wallet, bob_wallet): ) assert success is False - current_stake = subtensor.get_stake( - alice_wallet.coldkey.ss58_address, - bob_wallet.hotkey.ss58_address, + current_stake = subtensor.staking.get_stake( + coldkey_ss58=alice_wallet.coldkey.ss58_address, + hotkey_ss58=bob_wallet.hotkey.ss58_address, netuid=alice_subnet_netuid, ) assert current_stake == Balance(0).set_unit(alice_subnet_netuid), ( @@ -380,9 +380,9 @@ def test_safe_staking_scenarios(subtensor, alice_wallet, bob_wallet): ) # 2. Partial allowed - should succeed partially - success = subtensor.add_stake( - alice_wallet, - bob_wallet.hotkey.ss58_address, + success = subtensor.staking.add_stake( + wallet=alice_wallet, + hotkey_ss58=bob_wallet.hotkey.ss58_address, netuid=alice_subnet_netuid, amount=stake_amount, wait_for_inclusion=True, @@ -393,9 +393,9 @@ def test_safe_staking_scenarios(subtensor, alice_wallet, bob_wallet): ) assert success is True - partial_stake = subtensor.get_stake( - alice_wallet.coldkey.ss58_address, - bob_wallet.hotkey.ss58_address, + partial_stake = subtensor.staking.get_stake( + coldkey_ss58=alice_wallet.coldkey.ss58_address, + hotkey_ss58=bob_wallet.hotkey.ss58_address, netuid=alice_subnet_netuid, ) assert partial_stake > Balance(0).set_unit(alice_subnet_netuid), ( @@ -407,9 +407,9 @@ def test_safe_staking_scenarios(subtensor, alice_wallet, bob_wallet): # 3. Higher threshold - should succeed fully amount = Balance.from_tao(100) - success = subtensor.add_stake( - alice_wallet, - bob_wallet.hotkey.ss58_address, + success = subtensor.staking.add_stake( + wallet=alice_wallet, + hotkey_ss58=bob_wallet.hotkey.ss58_address, netuid=alice_subnet_netuid, amount=amount, wait_for_inclusion=True, @@ -420,17 +420,17 @@ def test_safe_staking_scenarios(subtensor, alice_wallet, bob_wallet): ) assert success is True - full_stake = subtensor.get_stake( - alice_wallet.coldkey.ss58_address, - bob_wallet.hotkey.ss58_address, + full_stake = subtensor.staking.get_stake( + coldkey_ss58=alice_wallet.coldkey.ss58_address, + hotkey_ss58=bob_wallet.hotkey.ss58_address, netuid=alice_subnet_netuid, ) # Test Unstaking Scenarios # 1. Strict params - should fail - success = subtensor.unstake( - alice_wallet, - bob_wallet.hotkey.ss58_address, + success = subtensor.staking.unstake( + wallet=alice_wallet, + hotkey_ss58=bob_wallet.hotkey.ss58_address, netuid=alice_subnet_netuid, amount=full_stake, wait_for_inclusion=True, @@ -441,9 +441,9 @@ def test_safe_staking_scenarios(subtensor, alice_wallet, bob_wallet): ) assert success is False, "Unstake should fail." - current_stake = subtensor.get_stake( - alice_wallet.coldkey.ss58_address, - bob_wallet.hotkey.ss58_address, + current_stake = subtensor.staking.get_stake( + coldkey_ss58=alice_wallet.coldkey.ss58_address, + hotkey_ss58=bob_wallet.hotkey.ss58_address, netuid=alice_subnet_netuid, ) @@ -455,9 +455,9 @@ def test_safe_staking_scenarios(subtensor, alice_wallet, bob_wallet): ) # 2. Partial allowed - should succeed partially - success = subtensor.unstake( - alice_wallet, - bob_wallet.hotkey.ss58_address, + success = subtensor.staking.unstake( + wallet=alice_wallet, + hotkey_ss58=bob_wallet.hotkey.ss58_address, netuid=alice_subnet_netuid, amount=current_stake, wait_for_inclusion=True, @@ -468,9 +468,9 @@ def test_safe_staking_scenarios(subtensor, alice_wallet, bob_wallet): ) assert success is True - partial_unstake = subtensor.get_stake( - alice_wallet.coldkey.ss58_address, - bob_wallet.hotkey.ss58_address, + partial_unstake = subtensor.staking.get_stake( + coldkey_ss58=alice_wallet.coldkey.ss58_address, + hotkey_ss58=bob_wallet.hotkey.ss58_address, netuid=alice_subnet_netuid, ) logging.console.info(f"[orange]Partial unstake: {partial_unstake}[orange]") @@ -479,9 +479,9 @@ def test_safe_staking_scenarios(subtensor, alice_wallet, bob_wallet): ) # 3. Higher threshold - should succeed fully - success = subtensor.unstake( - alice_wallet, - bob_wallet.hotkey.ss58_address, + success = subtensor.staking.unstake( + wallet=alice_wallet, + hotkey_ss58=bob_wallet.hotkey.ss58_address, netuid=alice_subnet_netuid, amount=partial_unstake, wait_for_inclusion=True, diff --git a/tests/unit_tests/extrinsics/asyncex/test_unstaking.py b/tests/unit_tests/extrinsics/asyncex/test_unstaking.py index ed74c76fe4..434cc00e9c 100644 --- a/tests/unit_tests/extrinsics/asyncex/test_unstaking.py +++ b/tests/unit_tests/extrinsics/asyncex/test_unstaking.py @@ -39,7 +39,7 @@ async def test_unstake_extrinsic(fake_wallet, mocker): fake_subtensor.substrate.compose_call.assert_awaited_once_with( call_module="SubtensorModule", - call_function="remove_stake", + call_function="remove_stake_aggregate", call_params={ "hotkey": "hotkey", "amount_unstaked": 1100000000, @@ -85,7 +85,7 @@ async def test_unstake_all_extrinsic(fake_wallet, mocker): fake_substrate.compose_call.assert_awaited_once_with( call_module="SubtensorModule", - call_function="remove_stake_full_limit", + call_function="remove_stake_full_limit_aggregate", call_params={ "hotkey": "hotkey", "netuid": fake_netuid, @@ -144,7 +144,7 @@ async def test_unstake_multiple_extrinsic(fake_wallet, mocker): fake_subtensor.substrate.compose_call.assert_any_call( call_module="SubtensorModule", - call_function="remove_stake", + call_function="remove_stake_aggregate", call_params={ "hotkey": "hotkey1", "amount_unstaked": 1100000000, @@ -153,7 +153,7 @@ async def test_unstake_multiple_extrinsic(fake_wallet, mocker): ) fake_subtensor.substrate.compose_call.assert_any_call( call_module="SubtensorModule", - call_function="remove_stake", + call_function="remove_stake_aggregate", call_params={ "hotkey": "hotkey1", "amount_unstaked": 1100000000, diff --git a/tests/unit_tests/extrinsics/test_unstaking.py b/tests/unit_tests/extrinsics/test_unstaking.py index 04b93111d2..ffab93ad18 100644 --- a/tests/unit_tests/extrinsics/test_unstaking.py +++ b/tests/unit_tests/extrinsics/test_unstaking.py @@ -35,7 +35,7 @@ def test_unstake_extrinsic(fake_wallet, mocker): fake_subtensor.substrate.compose_call.assert_called_once_with( call_module="SubtensorModule", - call_function="remove_stake", + call_function="remove_stake_aggregate", call_params={ "hotkey": "hotkey", "amount_unstaked": 1100000000, @@ -80,7 +80,7 @@ def test_unstake_all_extrinsic(fake_wallet, mocker): fake_subtensor.substrate.compose_call.assert_called_once_with( call_module="SubtensorModule", - call_function="remove_stake_full_limit", + call_function="remove_stake_full_limit_aggregate", call_params={ "hotkey": "hotkey", "netuid": fake_netuid, @@ -138,16 +138,7 @@ def test_unstake_multiple_extrinsic(fake_wallet, mocker): fake_subtensor.substrate.compose_call.assert_any_call( call_module="SubtensorModule", - call_function="remove_stake", - call_params={ - "hotkey": "hotkey1", - "amount_unstaked": 1100000000, - "netuid": 1, - }, - ) - fake_subtensor.substrate.compose_call.assert_any_call( - call_module="SubtensorModule", - call_function="remove_stake", + call_function="remove_stake_aggregate", call_params={ "hotkey": "hotkey1", "amount_unstaked": 1100000000, From 6317d098d7e871871c57dc340f215bdbd1fe06c0 Mon Sep 17 00:00:00 2001 From: Roman Date: Thu, 7 Aug 2025 18:11:57 -0700 Subject: [PATCH 05/12] `swap_stake` -> `swap_stake_aggregate` --- bittensor/core/extrinsics/asyncex/move_stake.py | 2 +- bittensor/core/extrinsics/move_stake.py | 2 +- tests/unit_tests/test_subtensor_extended.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bittensor/core/extrinsics/asyncex/move_stake.py b/bittensor/core/extrinsics/asyncex/move_stake.py index 8ed6a29141..2f9c4de3e7 100644 --- a/bittensor/core/extrinsics/asyncex/move_stake.py +++ b/bittensor/core/extrinsics/asyncex/move_stake.py @@ -240,7 +240,7 @@ async def swap_stake_extrinsic( f"Amount: [green]{amount}[/green] from netuid [green]{origin_netuid}[/green] to netuid " f"[green]{destination_netuid}[/green]" ) - call_function = "swap_stake" + call_function = "swap_stake_aggregate" call = await subtensor.substrate.compose_call( call_module="SubtensorModule", diff --git a/bittensor/core/extrinsics/move_stake.py b/bittensor/core/extrinsics/move_stake.py index d3874f1e68..b1d6fa6326 100644 --- a/bittensor/core/extrinsics/move_stake.py +++ b/bittensor/core/extrinsics/move_stake.py @@ -236,7 +236,7 @@ def swap_stake_extrinsic( f"Amount: [green]{amount}[/green] from netuid [green]{origin_netuid}[/green] to netuid " f"[green]{destination_netuid}[/green]" ) - call_function = "swap_stake" + call_function = "swap_stake_aggregate" call = subtensor.substrate.compose_call( call_module="SubtensorModule", diff --git a/tests/unit_tests/test_subtensor_extended.py b/tests/unit_tests/test_subtensor_extended.py index ec6015174b..ac9c5967f0 100644 --- a/tests/unit_tests/test_subtensor_extended.py +++ b/tests/unit_tests/test_subtensor_extended.py @@ -1076,7 +1076,7 @@ def test_swap_stake(mock_substrate, subtensor, fake_wallet, mocker): mock_substrate, fake_wallet.coldkey, call_module="SubtensorModule", - call_function="swap_stake", + call_function="swap_stake_aggregate", call_params={ "hotkey": fake_wallet.hotkey.ss58_address, "origin_netuid": 1, From bba2f6549fb74d95b0b46f36f617987a399318df Mon Sep 17 00:00:00 2001 From: Roman Date: Thu, 7 Aug 2025 18:17:53 -0700 Subject: [PATCH 06/12] `move_stake` -> `move_stake_aggregate` --- bittensor/core/extrinsics/asyncex/move_stake.py | 2 +- bittensor/core/extrinsics/move_stake.py | 2 +- tests/unit_tests/test_subtensor_extended.py | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bittensor/core/extrinsics/asyncex/move_stake.py b/bittensor/core/extrinsics/asyncex/move_stake.py index 2f9c4de3e7..31f248826e 100644 --- a/bittensor/core/extrinsics/asyncex/move_stake.py +++ b/bittensor/core/extrinsics/asyncex/move_stake.py @@ -353,7 +353,7 @@ async def move_stake_extrinsic( ) call = await subtensor.substrate.compose_call( call_module="SubtensorModule", - call_function="move_stake", + call_function="move_stake_aggregate", call_params={ "origin_hotkey": origin_hotkey, "origin_netuid": origin_netuid, diff --git a/bittensor/core/extrinsics/move_stake.py b/bittensor/core/extrinsics/move_stake.py index b1d6fa6326..38dd760a1e 100644 --- a/bittensor/core/extrinsics/move_stake.py +++ b/bittensor/core/extrinsics/move_stake.py @@ -348,7 +348,7 @@ def move_stake_extrinsic( ) call = subtensor.substrate.compose_call( call_module="SubtensorModule", - call_function="move_stake", + call_function="move_stake_aggregate", call_params={ "origin_hotkey": origin_hotkey, "origin_netuid": origin_netuid, diff --git a/tests/unit_tests/test_subtensor_extended.py b/tests/unit_tests/test_subtensor_extended.py index ac9c5967f0..0912948990 100644 --- a/tests/unit_tests/test_subtensor_extended.py +++ b/tests/unit_tests/test_subtensor_extended.py @@ -710,7 +710,7 @@ def test_move_stake(mock_substrate, subtensor, fake_wallet, wait): mock_substrate, fake_wallet.coldkey, call_module="SubtensorModule", - call_function="move_stake", + call_function="move_stake_aggregate", call_params={ "origin_hotkey": "origin_hotkey", "origin_netuid": 1, @@ -761,7 +761,7 @@ def test_move_stake_error(mock_substrate, subtensor, fake_wallet, mocker): mock_substrate, fake_wallet.coldkey, call_module="SubtensorModule", - call_function="move_stake", + call_function="move_stake_aggregate", call_params={ "origin_hotkey": "origin_hotkey", "origin_netuid": 1, @@ -792,7 +792,7 @@ def test_move_stake_exception(mock_substrate, subtensor, fake_wallet): mock_substrate, fake_wallet.coldkey, call_module="SubtensorModule", - call_function="move_stake", + call_function="move_stake_aggregate", call_params={ "origin_hotkey": "origin_hotkey", "origin_netuid": 1, From 6f8534aeef8867963ddd35581263255011f0a95f Mon Sep 17 00:00:00 2001 From: Roman Date: Thu, 7 Aug 2025 18:21:43 -0700 Subject: [PATCH 07/12] `transfer_stake` -> `transfer_stake_aggregate` --- bittensor/core/extrinsics/asyncex/move_stake.py | 2 +- bittensor/core/extrinsics/move_stake.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bittensor/core/extrinsics/asyncex/move_stake.py b/bittensor/core/extrinsics/asyncex/move_stake.py index 31f248826e..43a34f9371 100644 --- a/bittensor/core/extrinsics/asyncex/move_stake.py +++ b/bittensor/core/extrinsics/asyncex/move_stake.py @@ -98,7 +98,7 @@ async def transfer_stake_extrinsic( ) call = await subtensor.substrate.compose_call( call_module="SubtensorModule", - call_function="transfer_stake", + call_function="transfer_stake_aggregate", call_params={ "destination_coldkey": destination_coldkey_ss58, "hotkey": hotkey_ss58, diff --git a/bittensor/core/extrinsics/move_stake.py b/bittensor/core/extrinsics/move_stake.py index 38dd760a1e..929c4d76a6 100644 --- a/bittensor/core/extrinsics/move_stake.py +++ b/bittensor/core/extrinsics/move_stake.py @@ -95,7 +95,7 @@ def transfer_stake_extrinsic( ) call = subtensor.substrate.compose_call( call_module="SubtensorModule", - call_function="transfer_stake", + call_function="transfer_stake_aggregate", call_params={ "destination_coldkey": destination_coldkey_ss58, "hotkey": hotkey_ss58, From 015a7fddedc4951596f56abfe75f98bee0a860c4 Mon Sep 17 00:00:00 2001 From: Roman Date: Thu, 7 Aug 2025 18:21:51 -0700 Subject: [PATCH 08/12] fix test --- tests/unit_tests/test_subtensor_extended.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit_tests/test_subtensor_extended.py b/tests/unit_tests/test_subtensor_extended.py index 0912948990..60a6bfb921 100644 --- a/tests/unit_tests/test_subtensor_extended.py +++ b/tests/unit_tests/test_subtensor_extended.py @@ -1420,7 +1420,7 @@ def test_transfer_stake(mock_substrate, subtensor, fake_wallet, mocker, wait): mock_substrate, fake_wallet.coldkey, call_module="SubtensorModule", - call_function="transfer_stake", + call_function="transfer_stake_aggregate", call_params={ "destination_coldkey": "dest", "hotkey": "hotkey_ss58", @@ -1471,7 +1471,7 @@ def test_transfer_stake_error( mock_substrate, fake_wallet.coldkey, call_module="SubtensorModule", - call_function="transfer_stake", + call_function="transfer_stake_aggregate", call_params={ "destination_coldkey": "dest", "hotkey": "hotkey_ss58", From e3f0471fcd5301360468cbfe88c674455b3021fc Mon Sep 17 00:00:00 2001 From: Roman Date: Thu, 7 Aug 2025 18:22:15 -0700 Subject: [PATCH 09/12] ruff --- tests/e2e_tests/test_staking.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/e2e_tests/test_staking.py b/tests/e2e_tests/test_staking.py index 7553894de3..c6f9d73970 100644 --- a/tests/e2e_tests/test_staking.py +++ b/tests/e2e_tests/test_staking.py @@ -78,7 +78,9 @@ def test_single_operation(subtensor, alice_wallet, bob_wallet): logging.console.info(f"Bob stake: {stake_bob}") assert stake_bob > Balance(0).set_unit(alice_subnet_netuid) - stakes = subtensor.get_stake_for_coldkey(coldkey_ss58=alice_wallet.coldkey.ss58_address) + stakes = subtensor.get_stake_for_coldkey( + coldkey_ss58=alice_wallet.coldkey.ss58_address + ) expected_stakes = [ StakeInfo( From 4dc78d9e2f0732bb6053b36b3c14ad677c158878 Mon Sep 17 00:00:00 2001 From: Roman Date: Fri, 8 Aug 2025 13:24:20 -0700 Subject: [PATCH 10/12] add `remove_stake_limit_aggregate` --- bittensor/core/extrinsics/unstaking.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bittensor/core/extrinsics/unstaking.py b/bittensor/core/extrinsics/unstaking.py index 29436cc7db..af8bf31b7d 100644 --- a/bittensor/core/extrinsics/unstaking.py +++ b/bittensor/core/extrinsics/unstaking.py @@ -129,7 +129,7 @@ def unstake_extrinsic( "allow_partial": allow_partial_stake, } ) - call_function = "remove_stake_limit" + call_function = "remove_stake_limit_aggregate" else: logging.info( f":satellite: [magenta]Unstaking from:[/magenta] " From d0f06b503a27f9d6b4c3729225d5767b37eea0fe Mon Sep 17 00:00:00 2001 From: Roman Date: Fri, 8 Aug 2025 13:25:10 -0700 Subject: [PATCH 11/12] add error message --- tests/e2e_tests/test_staking.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e_tests/test_staking.py b/tests/e2e_tests/test_staking.py index c6f9d73970..d31b023655 100644 --- a/tests/e2e_tests/test_staking.py +++ b/tests/e2e_tests/test_staking.py @@ -370,7 +370,7 @@ def test_safe_staking_scenarios(subtensor, alice_wallet, bob_wallet): rate_tolerance=0.005, # 0.5% allow_partial_stake=False, ) - assert success is False + assert success is False, "Staking should fail." current_stake = subtensor.staking.get_stake( coldkey_ss58=alice_wallet.coldkey.ss58_address, From 25af17176a967b6219e451fb358b005c05157569 Mon Sep 17 00:00:00 2001 From: Roman Date: Thu, 21 Aug 2025 10:57:45 -0700 Subject: [PATCH 12/12] `swap_stake_limit` -> `swap_stake_limit_aggregate` --- bittensor/core/extrinsics/asyncex/move_stake.py | 2 +- bittensor/core/extrinsics/move_stake.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bittensor/core/extrinsics/asyncex/move_stake.py b/bittensor/core/extrinsics/asyncex/move_stake.py index 43a34f9371..268d59e5fa 100644 --- a/bittensor/core/extrinsics/asyncex/move_stake.py +++ b/bittensor/core/extrinsics/asyncex/move_stake.py @@ -233,7 +233,7 @@ async def swap_stake_extrinsic( "allow_partial": allow_partial_stake, } ) - call_function = "swap_stake_limit" + call_function = "swap_stake_limit_aggregate" else: logging.info( f"Swapping stake for hotkey [blue]{hotkey_ss58}[/blue]\n" diff --git a/bittensor/core/extrinsics/move_stake.py b/bittensor/core/extrinsics/move_stake.py index 929c4d76a6..fd5002ee2b 100644 --- a/bittensor/core/extrinsics/move_stake.py +++ b/bittensor/core/extrinsics/move_stake.py @@ -229,7 +229,7 @@ def swap_stake_extrinsic( "allow_partial": allow_partial_stake, } ) - call_function = "swap_stake_limit" + call_function = "swap_stake_limit_aggregate" else: logging.info( f"Swapping stake for hotkey [blue]{hotkey_ss58}[/blue]\n"