Skip to content

Commit 571bc23

Browse files
authored
Merge pull request #102 from opentensor/release/1.1.1
Release/1.1.1
2 parents 2b0fac6 + 5535515 commit 571bc23

File tree

7 files changed

+37
-12
lines changed

7 files changed

+37
-12
lines changed

.github/workflows/check-sdk-tests.yml

-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ jobs:
229229
git fetch origin staging
230230
python3 -m pip install --upgrade pip
231231
python3 -m pip install '.[dev]'
232-
python3 -m pip install -r requirements/torch.txt
233232
234233
- name: Clone async-substrate-interface repo
235234
run: git clone https://github.com/opentensor/async-substrate-interface.git

CHANGELOG.md

+10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
## 1.1.1 /2025-04-26
4+
5+
## What's Changed
6+
* State-Safe RNG by @thewhaleking in https://github.com/opentensor/async-substrate-interface/pull/97
7+
* Fix tests requirements by @thewhaleking in https://github.com/opentensor/async-substrate-interface/pull/98
8+
* Update maintainers emails by @thewhaleking in https://github.com/opentensor/async-substrate-interface/pull/99
9+
* Adds additional exception for catching by @thewhaleking in https://github.com/opentensor/async-substrate-interface/pull/96
10+
11+
**Full Changelog**: https://github.com/opentensor/async-substrate-interface/compare/v1.1.0...v1.1.1
12+
313
## 1.1.0 /2025-04-07
414

515
## What's Changed

async_substrate_interface/async_substrate.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import asyncio
88
import inspect
99
import logging
10-
import random
1110
import ssl
1211
import time
1312
from hashlib import blake2b
@@ -39,6 +38,7 @@
3938
SubstrateRequestException,
4039
ExtrinsicNotFound,
4140
BlockNotFound,
41+
MaxRetriesExceeded,
4242
)
4343
from async_substrate_interface.types import (
4444
ScaleObj,
@@ -48,7 +48,12 @@
4848
SubstrateMixin,
4949
Preprocessed,
5050
)
51-
from async_substrate_interface.utils import hex_to_bytes, json, get_next_id
51+
from async_substrate_interface.utils import (
52+
hex_to_bytes,
53+
json,
54+
get_next_id,
55+
rng as random,
56+
)
5257
from async_substrate_interface.utils.cache import async_sql_lru_cache
5358
from async_substrate_interface.utils.decoding import (
5459
_determine_if_old_runtime_call,
@@ -1910,7 +1915,7 @@ async def _make_rpc_request(
19101915
logger.warning(
19111916
f"Timed out waiting for RPC requests {attempt} times. Exiting."
19121917
)
1913-
raise SubstrateRequestException("Max retries reached.")
1918+
raise MaxRetriesExceeded("Max retries reached.")
19141919
else:
19151920
self.ws.last_received = time.time()
19161921
await self.ws.connect(force=True)

async_substrate_interface/errors.py

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ class SubstrateRequestException(Exception):
88
pass
99

1010

11+
class MaxRetriesExceeded(SubstrateRequestException):
12+
pass
13+
14+
1115
class StorageFunctionNotFound(ValueError):
1216
pass
1317

async_substrate_interface/sync_substrate.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import functools
22
import logging
3-
import random
43
from hashlib import blake2b
54
from typing import Optional, Union, Callable, Any
65

@@ -21,6 +20,7 @@
2120
ExtrinsicNotFound,
2221
SubstrateRequestException,
2322
BlockNotFound,
23+
MaxRetriesExceeded,
2424
)
2525
from async_substrate_interface.types import (
2626
SubstrateMixin,
@@ -30,7 +30,12 @@
3030
Preprocessed,
3131
ScaleObj,
3232
)
33-
from async_substrate_interface.utils import hex_to_bytes, json, get_next_id
33+
from async_substrate_interface.utils import (
34+
hex_to_bytes,
35+
json,
36+
get_next_id,
37+
rng as random,
38+
)
3439
from async_substrate_interface.utils.decoding import (
3540
_determine_if_old_runtime_call,
3641
_bt_decode_to_dict_or_list,
@@ -1611,7 +1616,7 @@ def _make_rpc_request(
16111616
logger.warning(
16121617
f"Timed out waiting for RPC requests {attempt} times. Exiting."
16131618
)
1614-
raise SubstrateRequestException("Max retries reached.")
1619+
raise MaxRetriesExceeded("Max retries reached.")
16151620
else:
16161621
return self._make_rpc_request(
16171622
payloads,

async_substrate_interface/utils/__init__.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55

66
id_cycle = cycle(range(1, 999))
77

8+
rng = random.Random()
9+
810

911
def get_next_id() -> str:
1012
"""
1113
Generates a pseudo-random ID by returning the next int of a range from 1-998 prepended with
1214
two random ascii characters.
1315
"""
14-
random_letters = "".join(random.choices(string.ascii_letters, k=2))
16+
random_letters = "".join(rng.choices(string.ascii_letters, k=2))
1517
return f"{random_letters}{next(id_cycle)}"
1618

1719

pyproject.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "async-substrate-interface"
3-
version = "1.1.0"
3+
version = "1.1.1"
44
description = "Asyncio library for interacting with substrate. Mostly API-compatible with py-substrate-interface"
55
readme = "README.md"
66
license = { file = "LICENSE" }
@@ -20,12 +20,12 @@ requires-python = ">=3.9,<3.14"
2020

2121
authors = [
2222
{ name = "Opentensor Foundation" },
23-
{ name = "BD Himes", email = "[email protected]" }
23+
{ name = "BD Himes", email = "[email protected]" }
2424
]
2525

2626
maintainers = [
27-
{ name = "Opentensor Foundation", email = "[email protected]" },
28-
{ name = "BD Himes", email = "[email protected]" }
27+
{ name = "Latent Holdings" },
28+
{ name = "BD Himes", email = "[email protected]" }
2929
]
3030

3131
classifiers = [

0 commit comments

Comments
 (0)