Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/_run-e2e-single.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
echo "::endgroup::"
if [ "$i" -lt 3 ]; then
echo "Retrying..."
sleep 5
sleep 15
fi
fi

Expand Down
3 changes: 2 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
The MIT License (MIT)
Copyright © 2021 Yuma Rao
Copyright © 2025 The Opentensor Foundation
Copyright © 2025 Yuma Rao

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the “Software”), to deal in the Software without restriction, including without limitation
Expand Down
53 changes: 33 additions & 20 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
3. ✅ Set `wait_for_inclusion` and `wait_for_finalization` to `True` by default in extrinsics and their related calls. Then we will guarantee the correct/expected extrinsic call response is consistent with the chain response. If the user changes those values, then it is the user's responsibility.
4. ✅ Make the internal logic of extrinsics the same. There are extrinsics that are slightly different in implementation.

5. Since SDK is not a responsible tool, try to remove all calculations inside extrinsics that do not affect the result, but are only used in logging. Actually, this should be applied not to extrinsics only but for all codebase.
5. ✅ ~~Since SDK is not a responsible tool, try to remove all calculations inside extrinsics that do not affect the result, but are only used in logging. Actually, this should be applied not to extrinsics only but for all codebase.~~ Just improved regarding usage.

6. ✅ Remove `unstake_all` parameter from `unstake_extrinsic` since we have `unstake_all_extrinsic`which is calles another subtensor function.

7. ✅ `unstake` and `unstake_multiple` extrinsics should have `safe_unstaking` parameters instead of `safe_staking`.

8. ✅ Remove `_do*` extrinsic calls and combine them with extrinsic logic.

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`.
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.
Expand All @@ -41,7 +41,7 @@
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
1. Reduce the amount of logging.info or transfer part of logging.info to logging.debug `(in progress)`

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.
Expand All @@ -53,17 +53,17 @@ rename this variable in 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.

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

7. ✅ Replace `Arguments` with `Parameters`. Matches Python rules. Improve docstrings for writing MСP server.

8. ✅ Remove all type annotations for parameters in docstrings.

9. Remove all logic related to CRv3 as it will be removed from the chain next week.
9. Remove all logic related to CRv3 as it will be removed from the chain next week.
- [x] CRv3 extrinsics
- [ ] CRv3 logic related subtensor's calls
- [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.

Expand All @@ -77,10 +77,10 @@ rename this variable in documentation.
## 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
3. Implement Sub-subnets logic. Subtensor PR https://github.com/opentensor/subtensor/pull/1984

## Testing
1. When running tests via Docker, ensure no lingering processes occupy required ports before launch.
1. When running tests via Docker, ensure no lingering processes occupy required ports before launch.

2. Improve failed test reporting from GH Actions to the Docker channel (e.g., clearer messages, formatting).

Expand Down Expand Up @@ -112,13 +112,13 @@ It must include:

# Migration guide

- [x] `._do_commit_reveal_v3` logic is included in the main code `.commit_reveal_v3_extrinsic`
- [x] `revecommit_reveal_version` parameter with default value `4` added to `revecommit_reveal_version`
- [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`
- [x] `._do_reveal_weights` logic is included in the main code `.reveal_weights_extrinsic`
- [x] `._do_set_weights` logic is included in the main code `.set_weights_extrinsic`
- [x] `set_weights_extrinsic` moved to `bittensor/core/extrinsics/commit_weights.py`
- [x] `bittensor/core/extrinsics/commit_weights.py` module renamed to `bittensor/core/extrinsics/weights.py` (consistent naming with async module)
- [x] `bittensor/core/extrinsics/commit_weights.py` module renamed to `bittensor/core/extrinsics/weights.py` (consistent naming with async module)
- [x] `_do_burned_register` logic is included in the main code `.burned_register_extrinsic`
- [x] `_do_pow_register` logic is included in the main code `.register_extrinsic`
- [x] `._do_set_root_weights` logic is included in the main code `.set_root_weights_extrinsic`
Expand Down Expand Up @@ -199,25 +199,38 @@ Additional changes in extrinsics:

Removing deprecated extrinsics and replacing them with consistent ones:
- `commit_reveal_extrinsic` (without mechanisms support) + related tests
- `bittensor.core.extrinsics.mechanism.commit_timelocked_mechanism_weights_extrinsic` moved and renamed to `bittensor.core.extrinsics.weights.commit_timelocked_weights_extrinsic`
- `bittensor.core.extrinsics.asyncex.mechanism.commit_timelocked_mechanism_weights_extrinsic` moved and renamed to `bittensor.core.extrinsics.asyncex.weights.commit_timelocked_weights_extrinsic`
- `bittensor.core.extrinsics.mechanism.commit_timelocked_mechanism_weights_extrinsic` moved and renamed to `bittensor.core.extrinsics.weights.commit_timelocked_weights_extrinsic`
- `bittensor.core.extrinsics.asyncex.mechanism.commit_timelocked_mechanism_weights_extrinsic` moved and renamed to `bittensor.core.extrinsics.asyncex.weights.commit_timelocked_weights_extrinsic`

- `commit_weights_extrinsic`(without mechanisms support) + related tests
- `bittensor.core.extrinsics.mechanism.commit_mechanism_weights_extrinsic` moved and renamed to `bittensor.core.extrinsics.weights.commit_weights_extrinsic`
- `bittensor.core.extrinsics.asyncex.mechanism.commit_mechanism_weights_extrinsic` moved and renamed to `bittensor.core.extrinsics.asyncex.weights.commit_weights_extrinsic`
- `bittensor.core.extrinsics.mechanism.commit_mechanism_weights_extrinsic` moved and renamed to `bittensor.core.extrinsics.weights.commit_weights_extrinsic`
- `bittensor.core.extrinsics.asyncex.mechanism.commit_mechanism_weights_extrinsic` moved and renamed to `bittensor.core.extrinsics.asyncex.weights.commit_weights_extrinsic`

- `reveal_weights_extrinsic`(without mechanisms support) + related tests
- `bittensor.core.extrinsics.mechanism.reveal_mechanism_weights_extrinsic` moved and renamed to `bittensor.core.extrinsics.weights.reveal_weights_extrinsic`
- `bittensor.core.extrinsics.asyncex.mechanism.reveal_mechanism_weights_extrinsic` moved and renamed to `bittensor.core.extrinsics.asyncex.weights.reveal_weights_extrinsic`
- `bittensor.core.extrinsics.mechanism.reveal_mechanism_weights_extrinsic` moved and renamed to `bittensor.core.extrinsics.weights.reveal_weights_extrinsic`
- `bittensor.core.extrinsics.asyncex.mechanism.reveal_mechanism_weights_extrinsic` moved and renamed to `bittensor.core.extrinsics.asyncex.weights.reveal_weights_extrinsic`

- `set_weights_extrinsic`(without mechanisms support) + related tests
- `bittensor.core.extrinsics.mechanism.reveal_mechanism_weights_extrinsic` moved and renamed to `bittensor.core.extrinsics.weights.reveal_weights_extrinsic`
- `bittensor.core.extrinsics.asyncex.mechanism.reveal_mechanism_weights_extrinsic` moved and renamed to `bittensor.core.extrinsics.asyncex.weights.reveal_weights_extrinsic`
- `bittensor.core.extrinsics.mechanism.reveal_mechanism_weights_extrinsic` moved and renamed to `bittensor.core.extrinsics.weights.reveal_weights_extrinsic`
- `bittensor.core.extrinsics.asyncex.mechanism.reveal_mechanism_weights_extrinsic` moved and renamed to `bittensor.core.extrinsics.asyncex.weights.reveal_weights_extrinsic`

- `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`
- `burned_register_extrinsic`
- `register_extrinsic`
- `transfer_extrinsic`
- `unstake_extrinsic`
- `unstake_multiple_extrinsic`

### Subtensor changes
- method `all_subnets` has renamed parameter from `block_number` to `block`.
- 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 `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.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ ruff:
@python -m ruff format bittensor

check: ruff
@mypy --ignore-missing-imports bittensor/ --python-version=3.9
@mypy --ignore-missing-imports bittensor/ --python-version=3.10
@mypy --ignore-missing-imports bittensor/ --python-version=3.11
@mypy --ignore-missing-imports bittensor/ --python-version=3.12
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,8 @@ Ready to contribute? Read the [contributing guide](./contrib/CONTRIBUTING.md) be

## License
The MIT License (MIT)
Copyright © 2024 The Opentensor Foundation
Copyright © 2025 The Opentensor Foundation
Copyright © 2025 Yuma Rao

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
Loading
Loading