Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
bcd5332
method `get_stake_for_coldkey` removed, bc this is the same as `get_s…
basfroman Sep 29, 2025
f45df6c
`bittensor.core.subtensor_api` moved to `bittensor.core.addons.subten…
basfroman Sep 29, 2025
3dfccfc
fix imports + move timelock impl to addons
basfroman Sep 29, 2025
4782af6
more
basfroman Sep 29, 2025
9a99f3b
rename `SubtensorApi._subtensor` -> `SubtensorApi.inner_subtensor`
basfroman Sep 29, 2025
19add29
updated order
basfroman Sep 29, 2025
ef628e4
- method `get_subnets` renamed to `get_all_subnets_netuid` (more obvi…
basfroman Sep 29, 2025
bac4f7b
method `get_owned_hotkeys` get rid `reuse_block` parameter to be cons…
basfroman Sep 29, 2025
9942c19
All liquidity methods and related extrinsics received a renamed param…
basfroman Sep 29, 2025
2c4f775
deprecated `bittensor.utils.version.version_checking` removed
basfroman Sep 30, 2025
7e4140d
rename `hotkey` > `hotkey_ss58` in liquidity methods and extrinsics +…
basfroman Sep 30, 2025
656c3ba
method `blocks_since_last_update` improved. Currently it can be used …
basfroman Sep 30, 2025
303448c
method `blocks_since_last_update` improved. Currently it can be used …
basfroman Sep 30, 2025
e7f2774
attribute `DelegateInfo/lite.total_daily_return` has been deleted (Vu…
basfroman Sep 30, 2025
ed553ee
fix integration tests
basfroman Sep 30, 2025
0ec842d
fix integration tests + - `Async/Subtensor` parameter `_mock` renamed…
basfroman Sep 30, 2025
b16af2e
update MIGRATION.md
basfroman Sep 30, 2025
8813973
update MIGRATION.md
basfroman Sep 30, 2025
ef6cdd4
ops, _mock
basfroman Sep 30, 2025
1ef8161
fix `tests/e2e_tests/test_delegate.py`
basfroman Sep 30, 2025
b5965df
BT_SUBTENSOR_CHAIN_ENDPOINT + MIGRATION.md
basfroman Sep 30, 2025
6405718
ruff
basfroman Sep 30, 2025
83c45ce
fix `get_async_subtensor`
basfroman Sep 30, 2025
ba1f6dd
improve `easy_import.py`: removing inconsistent class names + referen…
basfroman Sep 30, 2025
4dd4e07
update MIGRATION.md
basfroman Sep 30, 2025
18c3def
use updated `subnet-template`
basfroman Sep 30, 2025
84199e4
use regular `subnet-template` (merged)
basfroman Sep 30, 2025
1a8eb6b
mode addons from `bittensor.core.addons` to `bittensor.addons` (logic…
basfroman Sep 30, 2025
4cadf54
Balance has strict check operations between instances regarding unit…
basfroman Sep 30, 2025
fb997bc
add `hex_to_ss58` and `ss58_to_hex` to `bittensor.utils.__init__`
basfroman Sep 30, 2025
5ad650a
new custom errors for balance check
basfroman Sep 30, 2025
c674914
`check_and_convert_to_balance` renamed to `check_balance_amount` + ne…
basfroman Sep 30, 2025
b9d299b
improve tests
basfroman Sep 30, 2025
74b1886
add `check_balance_amount` across subtensor's and extrinsics codebase…
basfroman Sep 30, 2025
614e26d
fix `get_transfer_fee`
basfroman Sep 30, 2025
c4d1ded
set debug for the login when block is older 300 in metagraph
basfroman Sep 30, 2025
c9f7166
Update bittensor/utils/balance.py
basfroman Oct 2, 2025
5013619
Update bittensor/utils/balance.py
basfroman Oct 2, 2025
3bdd9ea
review fixes
basfroman Oct 2, 2025
44ffc05
`bittensor.addons` -> `bittensor.extras`
basfroman Oct 2, 2025
69617ed
important wording
basfroman Oct 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 81 additions & 28 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,36 +24,36 @@
9. ✅ ~~`subtensor.get_transfer_fee` calls extrinsic inside the subtensor module. Actually the method could be updated by using `bittensor.core.extrinsics.utils.get_extrinsic_fee`.~~ `get_transfer_fee` isn't `get_extrinsic_fee`

## Subtensor
1. In the synchronous Subtensor class, the `get_owned_hotkeys` method includes a `reuse_block` parameter that is inconsistent with other methods. Either remove this parameter from `get_owned_hotkeys`, or add it to all other methods that directly call self.substrate.* to maintain a consistent interface.
2. In all methods where we `get_stake_operations_fee` is called, remove unused arguments. Consider combining all methods using `get_stake_operations_fee` into one common one.
3. Delete deprecated `get_current_weight_commit_info` and `get_current_weight_commit_info_v2`. Rename `get_timelocked_weight_commits` to get_current_weight_commit_info.
4. Remove references like `get_stake_info_for_coldkey = get_stake_for_coldkey`.
5. Reconsider some methods naming across the entire subtensor module.
6. Add `hotkey_ss58` parameter to `get_liquidity_list` method. One wallet can have many HKs. Currently, the mentioned method uses default HK only.
1. In the synchronous Subtensor class, the `get_owned_hotkeys` method includes a `reuse_block` parameter that is inconsistent with other methods. Either remove this parameter from `get_owned_hotkeys`, or add it to all other methods that directly call self.substrate.* to maintain a consistent interface.
2. In all methods where we `get_stake_operations_fee` is called, remove unused arguments. Consider combining all methods using `get_stake_operations_fee` into one common one.
3. Delete deprecated `get_current_weight_commit_info` and `get_current_weight_commit_info_v2`. ~~Rename `get_timelocked_weight_commits` to `get_current_weight_commit_info`.~~
4. Remove references like `get_stake_info_for_coldkey = get_stake_for_coldkey`.
5. Reconsider some methods naming across the entire subtensor module.
6. ~~Add `hotkey_ss58` parameter to `get_liquidity_list` method. One wallet can have many HKs. Currently, the mentioned method uses default HK only.~~ wrong idea

## Metagraph
1. Remove verbose archival node warnings for blocks older than 300. Some users complained about many messages for them.
2. Reconsider entire metagraph module logic.
1. Remove verbose archival node warnings for blocks older than 300. Some users complained about many messages for them.
2. Reconsider entire metagraph module logic.

## Balance
1. In `bittensor.utils.balance._check_currencies` raise the error instead of `warnings.warn`.
2. In `bittensor.utils.balance.check_and_convert_to_balance` raise the error instead of `warnings.warn`.
1. In `bittensor.utils.balance._check_currencies` raise the error instead of `warnings.warn`.
2. In `bittensor.utils.balance.check_and_convert_to_balance` raise the error instead of `warnings.warn`.
This may seem like a harsh decision at first, but ultimately we will push the community to use Balance and there will be fewer errors in their calculations. Confusion with TAO and Alpha in calculations and display/printing/logging will be eliminated.

## Common things
1. Reduce the amount of logging.info or transfer part of logging.info to logging.debug `(in progress)`
1. Reduce the amount of logging.info or transfer part of logging.info to logging.debug

2. To be consistent across all SDK regarding local environment variables name:
2. To be consistent across all SDK regarding local environment variables name:
remove `BT_CHAIN_ENDPOINT` (settings.py :line 124) and use `BT_SUBTENSOR_CHAIN_ENDPOINT` instead of that.
rename this variable in documentation.

3. Move `bittensor.utils.get_transfer_fn_params` to `bittensor.core.extrinsics.utils`.
3. ✅ ~~Move `bittensor.utils.get_transfer_fn_params` to `bittensor.core.extrinsics.utils`.~~ it's on the right place.

4. ✅ Common refactoring (improve type annotations, etc)

5. Rename `non-/fast-blocks` to `non-/fast-runtime` in related places to be consistent with subtensor repo. Related with testing, subtensor scripts, documentation.
5. ✅ ~~Rename `non-/fast-blocks` to `non-/fast-runtime` in related places to be consistent with subtensor repo. Related with testing, subtensor scripts, documentation.~~ done across many PRs.

6. To be consistent throughout the SDK `(in progress)`:
6. To be consistent throughout the SDK:
`hotkey`, `coldkey`, `hotkeypub`, and `coldkeypub` are keypairs
`hotkey_ss58`, `coldkey_ss58`, `hotkeypub_ss58`, and `coldkeypub_ss58` are SS58 addresses of keypair.

Expand All @@ -65,19 +65,19 @@ rename this variable in documentation.
- [x] CRv3 extrinsics
- [x] CRv3 logic related subtensor's calls

10. Revise `bittensor/utils/easy_imports.py` module to remove deprecated backwards compatibility objects. Use this module as a functionality for exporting existing objects to the package root to keep __init__.py minimal and simple.
10. Revise `bittensor/utils/easy_imports.py` module to remove deprecated backwards compatibility objects. Use this module as a functionality for exporting existing objects to the package root to keep __init__.py minimal and simple.

11. Remove `bittensor.utils.version.version_checking`
11. Remove deprecated `bittensor.utils.version.version_checking`

12. Find and process all `TODOs` across the entire code base. If in doubt, discuss each one with the team separately. SDK has 29 TODOs.
13. ✅ The SDK is dropping support for `Python 3.9` starting with this release.
14. ✅ Remove `Default is` and `Default to` in docstrings bc parameters enough.
15. camfairchild: TODO, but we should have a grab_metadata if we don't already. Maybe don't decode, but can have a call that removes the Raw prefix, and another just doing grab_metadata_raw (no decoding)

## New features
1. Add `bittensor.utils.hex_to_ss58` function. SDK still doesn't have it. (Probably inner import `from scalecodec import ss58_encode, ss58_decode`)
2. Implement Crowdloan logic. Issue: https://github.com/opentensor/bittensor/issues/3017
3. Implement Sub-subnets logic. Subtensor PR https://github.com/opentensor/subtensor/pull/1984
1. Add `bittensor.utils.hex_to_ss58` function. SDK still doesn't have it. (Probably inner import `from scalecodec import ss58_encode, ss58_decode`)
2. Implement Sub-subnets logic. Subtensor PR https://github.com/opentensor/subtensor/pull/1984
3. Implement `Crowdloan` logic. Issue: https://github.com/opentensor/bittensor/issues/3017

## Testing
1. ✅ When running tests via Docker, ensure no lingering processes occupy required ports before launch.
Expand All @@ -95,23 +95,21 @@ rename this variable in documentation.


## Implementation

To implement the above changes and prepare for the v10 release, the following steps must be taken:

- [x] Create a new branch named SDKv10.~~
All breaking changes and refactors should be targeted into this branch to isolate them from staging and maintain backward compatibility during development.
- [ ] Add a `MIGRATION.md` document at the root of the repository and use it as a check list. This file will serve as a changelog and technical reference.
- [x] Add a `MIGRATION.md` document at the root of the repository and use it as a check list. This file will serve as a changelog and technical reference.
It must include:
- [ ] All change categories (Extrinsics, Subtensor, Metagraph, etc.)
- [ ] Per-PR breakdown of what was added, removed, renamed, or refactored.
- [ ] Justifications and migration notes for users (if API behavior changed).
- [x] All change categories (Extrinsics, Subtensor, Metagraph, etc.)
- [x] Per-PR breakdown of what was added, removed, renamed, or refactored.
- [x] Justifications and migration notes for users (if API behavior changed).

- [ ] Based on the final `MIGRATION.md`, develop migration documentation for the community.
- [ ] Once complete, merge SDKv10 into staging and release version 10.


# Migration guide

- [x] `._do_commit_reveal_v3` logic is included in the main code `.commit_timelocked_weights_extrinsic`
- [x] `commit_reveal_version` parameter with default value `4` added to `commit_timelocked_weights_extrinsic`
- [x] `._do_commit_weights` logic is included in the main code `.commit_weights_extrinsic`
Expand All @@ -126,8 +124,8 @@ It must include:
- [x] `dest` parameter has been renamed to `destination` in `transfer_extrinsic` function and `subtensor.transfer` method.
- [x] obsolete extrinsic `set_root_weights_extrinsic` removed. Also related subtensor calls `subtensor.set_root_weights_extrinsic` removed too.

# Standardize parameter order is applied for (extrinsics and related calls):

# Standardize parameter order is applied for (extrinsics and related calls):
These parameters will now exist in all extrinsics and related calls (default values could be different depends by extrinsic):

```py
Expand Down Expand Up @@ -216,6 +214,7 @@ Removing deprecated extrinsics and replacing them with consistent ones:

- `decrease_take_extrinsic` and `increase_take_extrinsic` have been merged into a single set_take_extrinsic. The API now has a new `action: Literal["increase_take", "decrease_take"]` parameter (DRY rule).


### Extrinsics has extra data in response's `data` field:
- `add_stake_extrinsic`
- `add_stake_multiple_extrinsic`
Expand All @@ -225,15 +224,30 @@ Removing deprecated extrinsics and replacing them with consistent ones:
- `unstake_extrinsic`
- `unstake_multiple_extrinsic`


### Subtensor changes
- method `all_subnets` has renamed parameter from `block_number` to `block` (consistency in the codebase).
- The `hotkey` parameter, which meant ss58 key address, was renamed to `hotkey_ss58` in all methods (consistency in the codebase).
- The `hotkey` parameter, which meant ss58 key address, was renamed to `hotkey_ss58` in all methods and related extrinsics (consistency in the codebase).
- The `coldkey` parameter, which meant ss58 key address, was renamed to `coldkey_ss58` in all methods (consistency in the codebase).
- method `query_subtensor` has updated parameters order.
- method `query_module` has updated parameters order.
- method `query_map_subtensor` has updated parameters order.
- method `query_map` has updated parameters order.
- method `add_stake_multiple` has updated parameters order.
- method `get_stake_for_coldkey` removed, bc this is the same as `get_stake_info_for_coldkey`
- method `get_subnets` renamed to `get_all_subnets_netuid` (obvious name, consistent with existing names)
- method `get_owned_hotkeys` get rid `reuse_block` parameter to be consistent with other sync methods.
- method `blocks_since_last_update` improved. Currently it can be used to get historical data from archive node.
- methods (async) `get_subnet_validator_permits` and `get_subnet_owner_hotkey` got `block_hash` and `reuse_block` parameters.
- attribute `DelegateInfo/lite.total_daily_return` has been deleted (Vune confirmed that we shouldn't use it)
- `Async/Subtensor` parameter `_mock` renamed to `mock`, also moved to last one in order. Community can use mocked `Async/Subtensor` in their tests in the same way as in we use it in the codebase.
- method `get_traansfer_fee` has renamed parameter `value` to `amount`

Added sub-package `bittensor.core.addons` to host optional extensions and experimental logic enhancing the core functionality.
- `bittensor.core.subtensor_api` moved to `bittensor.core.addons.subtensor_api`
- `bittensor.core.timelock` moved to `bittensor.core.addons.timelock`
- local env variable `BT_CHAIN_ENDPOINT` replaced with `BT_SUBTENSOR_CHAIN_ENDPOINT`.


### Mechid related changes:
In the next subtensor methods got updated the parameters order:
Expand All @@ -249,5 +263,44 @@ In the next subtensor methods got updated the parameters order:
Additional:
- `bittensor.core.chain_data.metagraph_info.MetagraphInfo` got required attribute `mechid: int`.


### Renames parameters:
- `get_metagraph_info`: `field_indices` -> `selected_indices` (to be consistent)


### `easy_import.py` module
Added:
- `from bittenosor import extrinsics`
- `from bittenosor import mock`
- `from bittenosor import get_async_subtensor`

Next variables removed:
- `async_subtensor` not -> `AsyncSubtensor`
- `axon` not -> `Axon`
- `config` not -> `Config`
- `dendrite` not -> `Dendrite`
- `keyfile` not -> `Keyfile`
- `metagraph` not -> `Metagraph`
- `wallet` not -> `Wallet`
- `subtensor` not -> `Subtensor`
- `synapse` not -> `Synapse`

Links to subpackages removed:
- `bittensor.mock` (available in `bittensor.core.mock`)
- `bittensor.extrinsics` (available in `bittensor.core.extrinsics`)


New subpackage `bittensor.extras` created to host optional extensions and experimental logic enhancing the core functionality.
Currently it contains:
- `bittensor.extras.subtensor_api`
- `bittensor.extras.timelock`


### Balance (bittensor/utils/balance.py) and related changes
- [x] Added 2 custom errors:
- `bittensor.core.errors.BalanceUnitMismatchError`
- `bittensor.core.errors.BalanceTypeError`
- [x] `check_balance` renamed to `check_balance_amount`
- [x] `check_and_convert_to_balance` renamed to `check_balance_amount`
- [x] `check_balance_amount` raised `BalanceTypeError` error instead of deprecated warning message.
- [x] private function `bittensor.utils.balance._check_currencies` raises `BalanceUnitMismatchError` error instead of deprecated warning message. This function is used inside the Balance class to check if units match during various mathematical and logical operations.
Loading
Loading