Skip to content

Commit cc2844d

Browse files
authored
Merge branch 'staging' into improve/remove-extra-stake-assignments
2 parents 574dbe4 + 3db617d commit cc2844d

File tree

15 files changed

+170
-178
lines changed

15 files changed

+170
-178
lines changed

CHANGELOG.md

Lines changed: 0 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,5 @@
11
# Changelog
22

3-
## 9.0.0 /2025-02-13
4-
5-
## What's Changed
6-
* Optimisations and tests for Async Sync Subtensor by @thewhaleking in https://github.com/opentensor/bittensor/pull/2569
7-
* [SDK] Get rid of py-substrate-interface (DO NOT MERGE) by @roman-opentensor in https://github.com/opentensor/bittensor/pull/2565
8-
* Uses the new async_substrate_interface lib by @thewhaleking in https://github.com/opentensor/bittensor/pull/2572
9-
* AsyncSubstrateInterface Overhaul (with Sync AsyncSubstrate) by @thewhaleking in https://github.com/opentensor/bittensor/pull/2526
10-
* [SDK] Small improvements by @roman-opentensor in https://github.com/opentensor/bittensor/pull/2575
11-
* Sync Subtensor warning by @thewhaleking in https://github.com/opentensor/bittensor/pull/2578
12-
* [SDK] Fixes types in async by @thewhaleking in https://github.com/opentensor/bittensor/pull/2577
13-
* Release/8.5.2 by @ibraheem-opentensor in https://github.com/opentensor/bittensor/pull/2584
14-
* fix: typos in documentation files by @leopardracer in https://github.com/opentensor/bittensor/pull/2580
15-
* fix(2337): btlogging setLevel by @zyzniewski-reef in https://github.com/opentensor/bittensor/pull/2588
16-
* perf: don't use 2 threads to create FastAPI server by @zyzniewski-reef in https://github.com/opentensor/bittensor/pull/2592
17-
* fix(2188): don't allow uvicorn to reconfigure event_loop_policy by @zyzniewski-reef in https://github.com/opentensor/bittensor/pull/2591
18-
* Fix spelling errors by @Dimitrolito in https://github.com/opentensor/bittensor/pull/2586
19-
* Make code as beautiful as it has never been before by @roman-opentensor in https://github.com/opentensor/bittensor/pull/2599
20-
* test: bring back old (sync subtensor) tests and fix them by @zyzniewski-reef in https://github.com/opentensor/bittensor/pull/2600
21-
* YAASO: Yet Another AsyncSubtensor Overhaul by @thewhaleking in https://github.com/opentensor/bittensor/pull/2579
22-
* Add alias for `Subtensor.commit` as `set_commitment` by @roman-opentensor in https://github.com/opentensor/bittensor/pull/2606
23-
* [RAO] Add methods to fetch metagraph data from the chain by @roman-opentensor in https://github.com/opentensor/bittensor/pull/2605
24-
* Rewrite config.py by @roman-opentensor in https://github.com/opentensor/bittensor/pull/2607
25-
* Update metagraph class with `rao` stuff by @roman-opentensor in https://github.com/opentensor/bittensor/pull/2611
26-
* [RAO] fix for unit test + refactoring by @roman-opentensor in https://github.com/opentensor/bittensor/pull/2612
27-
* fix integration metagraph test by @roman-opentensor in https://github.com/opentensor/bittensor/pull/2613
28-
* Cleanups, fixes, improvements for rao by @thewhaleking in https://github.com/opentensor/bittensor/pull/2614
29-
* Adds deprecation notice for non-balance amounts by @ibraheem-opentensor in https://github.com/opentensor/bittensor/pull/2615
30-
* Staging pre merge port rao (New async substrate) by @ibraheem-opentensor in https://github.com/opentensor/bittensor/pull/2610
31-
* Tests for SyncSubtensor by @zyzniewski-reef in https://github.com/opentensor/bittensor/pull/2617
32-
* Many small fixes by @roman-opentensor in https://github.com/opentensor/bittensor/pull/2619
33-
* Use async-substrate-interface for runtime decoding by @zyzniewski-reef in https://github.com/opentensor/bittensor/pull/2618
34-
* Pins torch version to 2.5.1 by @ibraheem-opentensor in https://github.com/opentensor/bittensor/pull/2623
35-
* Fixes, adds stake and other methods by @thewhaleking in https://github.com/opentensor/bittensor/pull/2622
36-
* Fix typos by @Marcofann in https://github.com/opentensor/bittensor/pull/2620
37-
* Add `subnet_volume` field to `MetagraphInfo` and `DynamicInfo` by @roman-opentensor in https://github.com/opentensor/bittensor/pull/2624
38-
* Update wallet creation command logs post-install by @HudsonGraeme in https://github.com/opentensor/bittensor/pull/2621
39-
* fix subtensor methods for async by @thewhaleking in https://github.com/opentensor/bittensor/pull/2628
40-
* Subnet burn cost return type by @thewhaleking in https://github.com/opentensor/bittensor/pull/2629
41-
* Specifies a range of torch versions, rather than a pinned version. by @thewhaleking in https://github.com/opentensor/bittensor/pull/2632
42-
* Adds subnet registration extrinsic by @ibraheem-opentensor in https://github.com/opentensor/bittensor/pull/2630
43-
* Bumps btwallet 302 by @ibraheem-opentensor in https://github.com/opentensor/bittensor/pull/2633
44-
* SKD implementation for Subtensor `Feat/RPC Upgrades`. PR #1205 by @roman-opentensor in https://github.com/opentensor/bittensor/pull/2627
45-
* Bug fixes after release SDK v9.0.0rc1 by @roman-opentensor in https://github.com/opentensor/bittensor/pull/2637
46-
* Adds Latent Lite endpoint to the SDK by @ibraheem-opentensor in https://github.com/opentensor/bittensor/pull/2641
47-
* Bringing meta fields to a common form with float values float(TAO) instead of Balance and Tensor by @roman-opentensor in https://github.com/opentensor/bittensor/pull/2642
48-
* Adds `get_all_commitments` and fixes commitment tests and `query_map` by @thewhaleking in https://github.com/opentensor/bittensor/pull/2644
49-
* Fix for extra fields from chain data by @roman-opentensor in https://github.com/opentensor/bittensor/pull/2647
50-
* Fix InfoBase + dataclasses by @roman-opentensor in https://github.com/opentensor/bittensor/pull/2649
51-
* fix integration tests by @roman-opentensor in https://github.com/opentensor/bittensor/pull/2651
52-
* feat: Add logging for unexpected header keys in Synapse by @crStiv in https://github.com/opentensor/bittensor/pull/2587
53-
* Fixes Dendrite new loop close by @thewhaleking in https://github.com/opentensor/bittensor/pull/2654
54-
* Fix e2e tests by @zyzniewski-reef in https://github.com/opentensor/bittensor/pull/2639
55-
* feat/roman/deps by @roman-opentensor in https://github.com/opentensor/bittensor/pull/2655
56-
* Metagraph Improvements by @thewhaleking in https://github.com/opentensor/bittensor/pull/2659
57-
* add name and symbol fields to metagraph by @roman-opentensor in https://github.com/opentensor/bittensor/pull/2658
58-
* Using one determine_chain_endpoint_and_network by @roman-opentensor in https://github.com/opentensor/bittensor/pull/2661
59-
* Tests: separate `templates` fixture by @zyzniewski-reef in https://github.com/opentensor/bittensor/pull/2660
60-
* Merge `async-pre-merge-new-async` to `staging` by @roman-opentensor in https://github.com/opentensor/bittensor/pull/2656
61-
* Add `set_subnet_identity_extrinsic` and related stuff by @roman-opentensor in https://github.com/opentensor/bittensor/pull/2662
62-
* Changes the logging level for unexpected header keys to trace by @thewhaleking in https://github.com/opentensor/bittensor/pull/2666
63-
* Remove logs by @roman-opentensor in https://github.com/opentensor/bittensor/pull/2667
64-
* Tests: properly handle subprocesses (subtensor, miner, validator) by @zyzniewski-reef in https://github.com/opentensor/bittensor/pull/2664
65-
* Last-minute requests by @thewhaleking in https://github.com/opentensor/bittensor/pull/2665
66-
* Updates tao_weights for mainnet by @ibraheem-opentensor in https://github.com/opentensor/bittensor/pull/2669
67-
* Update deps and default network/endpoint by @roman-opentensor in https://github.com/opentensor/bittensor/pull/2670
68-
69-
## New Contributors
70-
* @leopardracer made their first contribution in https://github.com/opentensor/bittensor/pull/2580
71-
* @Dimitrolito made their first contribution in https://github.com/opentensor/bittensor/pull/2586
72-
* @Marcofann made their first contribution in https://github.com/opentensor/bittensor/pull/2620
73-
* @HudsonGraeme made their first contribution in https://github.com/opentensor/bittensor/pull/2621
74-
* @crStiv made their first contribution in https://github.com/opentensor/bittensor/pull/2587
75-
76-
**Full Changelog**: https://github.com/opentensor/bittensor/compare/v8.5.2...v9.0.0
77-
78-
## 9.0.0rc6 /2025-02-11
79-
* Using one determine_chain_endpoint_and_network by @roman-opentensor in https://github.com/opentensor/bittensor/pull/2661
80-
* Tests: separate templates fixture by @zyzniewski-reef in https://github.com/opentensor/bittensor/pull/2660
81-
* add name and symbol fields to metagraph by @roman-opentensor in https://github.com/opentensor/bittensor/pull/2658
82-
* Metagraph Improvements by @thewhaleking in https://github.com/opentensor/bittensor/pull/2659
83-
* feat/roman/add-subnet-identity-with-subnet-creation by @roman-opentensor in https://github.com/opentensor/bittensor/pull/2662
84-
85-
**Full Changelog**: https://github.com/opentensor/bittensor/compare/v9.0.0rc5...v9.0.0rc6
86-
873
## 9.0.0rc5 /2025-02-07
884
* Fix InfoBase + dataclasses @roman-opentensor in https://github.com/opentensor/bittensor/pull/2649
895

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
9.0.0
1+
9.0.0rc5

bittensor/core/settings.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "9.0.0"
1+
__version__ = "9.0.0rc5"
22

33
import os
44
import re
@@ -7,15 +7,18 @@
77
from munch import munchify
88

99

10+
READ_ONLY = os.getenv("READ_ONLY") == "1"
11+
1012
HOME_DIR = Path.home()
1113
USER_BITTENSOR_DIR = HOME_DIR / ".bittensor"
1214
WALLETS_DIR = USER_BITTENSOR_DIR / "wallets"
1315
MINERS_DIR = USER_BITTENSOR_DIR / "miners"
1416

1517

16-
# Create dirs if they don't exist
17-
WALLETS_DIR.mkdir(parents=True, exist_ok=True)
18-
MINERS_DIR.mkdir(parents=True, exist_ok=True)
18+
if not READ_ONLY:
19+
# Create dirs if they don't exist
20+
WALLETS_DIR.mkdir(parents=True, exist_ok=True)
21+
MINERS_DIR.mkdir(parents=True, exist_ok=True)
1922

2023
# Bittensor networks name
2124
NETWORKS = ["finney", "test", "archive", "local", "subvortex", "rao", "latent-lite"]

bittensor/utils/btlogging/loggingmachine.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
from statemachine import State, StateMachine
1818

19+
from bittensor.core.settings import READ_ONLY
1920
from bittensor.core.config import Config
2021
from bittensor.utils.btlogging.console import BittensorConsole
2122
from .defines import (
@@ -584,9 +585,12 @@ def add_args(cls, parser: argparse.ArgumentParser, prefix: str = None):
584585
default_logging_info = os.getenv("BT_LOGGING_INFO") or False
585586
default_logging_trace = os.getenv("BT_LOGGING_TRACE") or False
586587
default_logging_record_log = os.getenv("BT_LOGGING_RECORD_LOG") or False
587-
default_logging_logging_dir = os.getenv(
588-
"BT_LOGGING_LOGGING_DIR"
589-
) or os.path.join("~", ".bittensor", "miners")
588+
default_logging_logging_dir = (
589+
None
590+
if READ_ONLY
591+
else os.getenv("BT_LOGGING_LOGGING_DIR")
592+
or os.path.join("~", ".bittensor", "miners")
593+
)
590594
parser.add_argument(
591595
"--" + prefix_str + "logging.debug",
592596
action="store_true",

tests/e2e_tests/test_commit_weights.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ async def test_commit_weights_uses_next_nonce(local_chain, subtensor, alice_wall
167167
Raises:
168168
AssertionError: If any of the checks or verifications fail
169169
"""
170+
# Wait for 2 tempos to pass as CR3 only reveals weights after 2 tempos
171+
subtensor.wait_for_block(20)
172+
170173
netuid = 2
171174
print("Testing test_commit_and_reveal_weights")
172175
# Register root as Alice

tests/e2e_tests/test_incentive.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ async def test_incentive(local_chain, subtensor, templates, alice_wallet, bob_wa
2323
AssertionError: If any of the checks or verifications fail
2424
"""
2525

26+
# Wait for 2 tempos to spin up chain properly
27+
subtensor.wait_for_block(20)
28+
2629
print("Testing test_incentive")
2730
netuid = 2
2831

tests/unit_tests/conftest.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import pytest
22
from aioresponses import aioresponses
3+
from async_substrate_interface.sync_substrate import SubstrateInterface
4+
5+
import bittensor.core.subtensor
36

47

58
@pytest.fixture
@@ -11,3 +14,30 @@ def force_legacy_torch_compatible_api(monkeypatch):
1114
def mock_aio_response():
1215
with aioresponses() as m:
1316
yield m
17+
18+
19+
@pytest.fixture
20+
def mock_substrate_interface(mocker):
21+
mocked = mocker.MagicMock(
22+
autospec=SubstrateInterface,
23+
)
24+
25+
mocker.patch("bittensor.core.subtensor.SubstrateInterface", return_value=mocked)
26+
27+
return mocked
28+
29+
30+
@pytest.fixture
31+
def subtensor(mock_substrate_interface):
32+
return bittensor.core.subtensor.Subtensor()
33+
34+
35+
@pytest.fixture
36+
def mock_get_external_ip(mocker):
37+
mocked = mocker.Mock(
38+
return_value="192.168.1.1",
39+
)
40+
41+
mocker.patch("bittensor.utils.networking.get_external_ip", mocked)
42+
43+
return mocked

tests/unit_tests/extrinsics/asyncex/test_commit_reveal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
@pytest.fixture
1212
def subtensor(mocker):
1313
fake_substrate = mocker.AsyncMock()
14-
fake_substrate.websocket.sock.getsockopt.return_value = 0
14+
fake_substrate.websocket.socket.getsockopt.return_value = 0
1515
mocker.patch.object(
1616
subtensor_module, "AsyncSubstrateInterface", return_value=fake_substrate
1717
)

tests/unit_tests/extrinsics/test_commit_reveal.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,6 @@
66
from bittensor.core import subtensor as subtensor_module
77
from bittensor.core.chain_data import SubnetHyperparameters
88
from bittensor.core.extrinsics import commit_reveal
9-
from bittensor.core.subtensor import Subtensor
10-
11-
12-
@pytest.fixture
13-
def subtensor(mocker):
14-
fake_substrate = mocker.MagicMock()
15-
fake_substrate.websocket.sock.getsockopt.return_value = 0
16-
mocker.patch.object(
17-
subtensor_module, "SubstrateInterface", return_value=fake_substrate
18-
)
19-
yield Subtensor()
209

2110

2211
@pytest.fixture

tests/unit_tests/extrinsics/test_commit_weights.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,10 @@
1-
import pytest
21
from bittensor_wallet import Wallet
32

4-
from bittensor.core import subtensor as subtensor_module
5-
from bittensor.core.settings import version_as_int
6-
from bittensor.core.subtensor import Subtensor
73
from bittensor.core.extrinsics.commit_weights import (
84
_do_commit_weights,
95
_do_reveal_weights,
106
)
11-
12-
13-
@pytest.fixture
14-
def subtensor(mocker):
15-
fake_substrate = mocker.MagicMock()
16-
fake_substrate.websocket.sock.getsockopt.return_value = 0
17-
mocker.patch.object(
18-
subtensor_module, "SubstrateInterface", return_value=fake_substrate
19-
)
20-
return Subtensor()
7+
from bittensor.core.settings import version_as_int
218

229

2310
def test_do_commit_weights(subtensor, mocker):

0 commit comments

Comments
 (0)