Skip to content

Commit ef41ec2

Browse files
authored
Merge pull request #541 from opentensor/release/9.8.3
Release/9.8.3
2 parents 334faed + 965ea44 commit ef41ec2

File tree

6 files changed

+36
-44
lines changed

6 files changed

+36
-44
lines changed

CHANGELOG.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
# Changelog
22

3-
## 9.8.2/2025-07-09
3+
## 9.8.3 /2025-07-10
4+
* Updates stake move table with rate applied correctly. by @thewhaleking in https://github.com/opentensor/btcli/pull/538
5+
* change stake fee calculation by @thewhaleking in https://github.com/opentensor/btcli/pull/539
6+
7+
**Full Changelog**: https://github.com/opentensor/btcli/compare/v9.8.2...v9.8.3
8+
9+
## 9.8.2 /2025-07-09
410
* Ensure that the fees are shown in alpha, not Tao. by @thewhaleking in https://github.com/opentensor/btcli/pull/530
511
* remove unused subnet names mapping by @thewhaleking in https://github.com/opentensor/btcli/pull/531
612

7-
813
**Full Changelog**: https://github.com/opentensor/btcli/compare/v9.8.1...v9.8.2
914

10-
## 9.8.1/2025-07-08
15+
## 9.8.1 /2025-07-08
1116

1217
## What's Changed
1318
* Fixed broken type annotation. by @thewhaleking in https://github.com/opentensor/btcli/pull/523
@@ -20,7 +25,7 @@
2025

2126
**Full Changelog**: https://github.com/opentensor/btcli/compare/v9.8.0...v9.8.1
2227

23-
## 9.8.0/2025-07-07
28+
## 9.8.0 /2025-07-07
2429

2530
## What's Changed
2631
* Feat/logo urls in subnet identity by @ibraheem-abe in https://github.com/opentensor/btcli/pull/504
@@ -36,23 +41,23 @@
3641

3742
**Full Changelog**: https://github.com/opentensor/btcli/compare/v9.7.1...v9.8.0
3843

39-
## 9.7.1/2025-06-26
44+
## 9.7.1 /2025-06-26
4045

4146
## What's Changed
4247
* Convert hyperparams from strings by @thewhaleking in https://github.com/opentensor/btcli/pull/510
4348
* Ensure we parse strings for param names by @thewhaleking in https://github.com/opentensor/btcli/pull/511
4449

4550
**Full Changelog**: https://github.com/opentensor/btcli/compare/v9.7.0...v9.7.1
4651

47-
## 9.7.0/2025-06-16
52+
## 9.7.0 /2025-06-16
4853

4954
## What's Changed
5055
* Add `SKIP_PULL` variable for conftest.py by @basfroman in https://github.com/opentensor/btcli/pull/502
5156
* Feat: Adds netuid support in swap_hotkeys by @ibraheem-abe in https://github.com/opentensor/btcli/pull/505
5257

5358
**Full Changelog**: https://github.com/opentensor/btcli/compare/v9.6.0...v9.7.0
5459

55-
## 9.6.0/2025-06-12
60+
## 9.6.0 /2025-06-12
5661

5762
## What's Changed
5863
* Allows for staking to multiple netuids in one btcli command by @thewhaleking in https://github.com/opentensor/btcli/pull/481

bittensor_cli/cli.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,6 @@ def edit_help(cls, option_name: str, help_text: str):
277277
)
278278
rate_tolerance = typer.Option(
279279
None,
280-
"--slippage",
281-
"--slippage-tolerance",
282280
"--tolerance",
283281
"--rate-tolerance",
284282
help="Set the rate tolerance percentage for transactions (default: 0.05 for 5%).",
@@ -1257,8 +1255,6 @@ def set_config(
12571255
),
12581256
rate_tolerance: Optional[float] = typer.Option(
12591257
None,
1260-
"--slippage",
1261-
"--slippage-tolerance",
12621258
"--tolerance",
12631259
help="Set the rate tolerance percentage for transactions (e.g. 0.1 for 0.1%).",
12641260
),
@@ -1404,9 +1400,7 @@ def del_config(
14041400
wallet_hotkey: bool = typer.Option(False, *Options.wallet_hotkey.param_decls),
14051401
network: bool = typer.Option(False, *Options.network.param_decls),
14061402
use_cache: bool = typer.Option(False, "--cache"),
1407-
rate_tolerance: bool = typer.Option(
1408-
False, "--slippage", "--slippage-tolerance", "--tolerance"
1409-
),
1403+
rate_tolerance: bool = typer.Option(False, "--tolerance"),
14101404
safe_staking: bool = typer.Option(
14111405
False, "--safe-staking/--no-safe-staking", "--safe/--unsafe"
14121406
),

bittensor_cli/src/bittensor/subtensor_interface.py

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
decode_hex_identity_dict,
3737
validate_chain_endpoint,
3838
u16_normalized_float,
39+
U16_MAX,
3940
)
4041

4142
SubstrateClass = (
@@ -1526,28 +1527,16 @@ async def get_stake_fee(
15261527
5. Moving between coldkeys
15271528
"""
15281529

1529-
origin = None
1530-
if origin_hotkey_ss58 is not None and origin_netuid is not None:
1531-
origin = (origin_hotkey_ss58, origin_netuid)
1530+
if origin_netuid is None:
1531+
origin_netuid = 0
15321532

1533-
destination = None
1534-
if destination_hotkey_ss58 is not None and destination_netuid is not None:
1535-
destination = (destination_hotkey_ss58, destination_netuid)
1533+
fee_rate = await self.query("Swap", "FeeRate", [origin_netuid])
1534+
fee = amount * (fee_rate / U16_MAX)
15361535

1537-
result = await self.query_runtime_api(
1538-
runtime_api="StakeInfoRuntimeApi",
1539-
method="get_stake_fee",
1540-
params=[
1541-
origin,
1542-
origin_coldkey_ss58,
1543-
destination,
1544-
destination_coldkey_ss58,
1545-
amount,
1546-
],
1547-
block_hash=block_hash,
1548-
)
1536+
result = Balance.from_tao(fee)
1537+
result.set_unit(origin_netuid)
15491538

1550-
return Balance.from_rao(result)
1539+
return result
15511540

15521541
async def get_scheduled_coldkey_swap(
15531542
self,

bittensor_cli/src/commands/stake/move.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,16 @@ async def display_stake_movement_cross_subnets(
3838

3939
if origin_netuid == destination_netuid:
4040
subnet = await subtensor.subnet(origin_netuid)
41-
received_amount_tao = subnet.alpha_to_tao(amount_to_move)
42-
received_amount_tao -= stake_fee
41+
received_amount_tao = subnet.alpha_to_tao(amount_to_move - stake_fee)
42+
received_amount = subnet.tao_to_alpha(received_amount_tao)
4343

44-
if received_amount_tao < Balance.from_tao(0):
45-
print_error("Not enough Alpha to pay the transaction fee.")
44+
if received_amount < Balance.from_tao(0).set_unit(destination_netuid):
45+
print_error(
46+
f"Not enough Alpha to pay the transaction fee. The fee is {stake_fee}, "
47+
f"which would set the total received to {received_amount}."
48+
)
4649
raise ValueError
4750

48-
received_amount = subnet.tao_to_alpha(received_amount_tao)
4951
price = subnet.price.tao
5052
price_str = (
5153
str(float(price))
@@ -60,13 +62,15 @@ async def display_stake_movement_cross_subnets(
6062
price_destination = dynamic_destination.price.tao
6163
rate = price_origin / (price_destination or 1)
6264

63-
received_amount_tao = dynamic_origin.alpha_to_tao(amount_to_move)
64-
received_amount_tao -= stake_fee
65+
received_amount_tao = dynamic_origin.alpha_to_tao(amount_to_move - stake_fee)
6566
received_amount = dynamic_destination.tao_to_alpha(received_amount_tao)
6667
received_amount.set_unit(destination_netuid)
6768

68-
if received_amount < Balance.from_tao(0):
69-
print_error("Not enough Alpha to pay the transaction fee.")
69+
if received_amount < Balance.from_tao(0).set_unit(destination_netuid):
70+
print_error(
71+
f"Not enough Alpha to pay the transaction fee. The fee is {stake_fee}, "
72+
f"which would set the total received to {received_amount}."
73+
)
7074
raise ValueError
7175

7276
price_str = (

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "bittensor-cli"
7-
version = "9.8.2"
7+
version = "9.8.3"
88
description = "Bittensor CLI"
99
readme = "README.md"
1010
authors = [

tests/e2e_tests/test_unstaking.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ def test_unstaking(local_chain, wallet_setup):
231231
"144",
232232
],
233233
)
234-
assert "✅ Finalized" in stake_result.stdout
234+
assert "✅ Finalized" in stake_result.stdout, stake_result.stderr
235235

236236
stake_list = exec_command_bob(
237237
command="stake",

0 commit comments

Comments
 (0)