Skip to content

Commit 67bab6c

Browse files
authored
Merge pull request #187 from opentensor/release/1.5.3
Release/1.5.3
2 parents dec39be + 4948847 commit 67bab6c

File tree

5 files changed

+38
-5
lines changed

5 files changed

+38
-5
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
# Changelog
2+
## 1.5.3 /2025-09-16
3+
* edge case query map keys by @thewhaleking in https://github.com/opentensor/async-substrate-interface/pull/186
4+
5+
**Full Changelog**: https://github.com/opentensor/async-substrate-interface/compare/v1.5.2...v1.5.3
6+
27
## 1.5.2 /2025-09-08
38
* Improve test workflows by @basfroman in https://github.com/opentensor/async-substrate-interface/pull/173
49
* Adds env var support for setting cache size by @thewhaleking in https://github.com/opentensor/async-substrate-interface/pull/174

async_substrate_interface/utils/decoding.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,14 @@ def concat_hash_len(key_hasher: str) -> int:
135135
if decode_ss58:
136136
if kts[kts.index(", ") + 2 : kts.index(")")] == "scale_info::0":
137137
item_key = ss58_encode(bytes(item_key[0]), runtime.ss58_format)
138-
139138
else:
140-
item_key = tuple(
141-
dk[key + 1] for key in range(len(params), len(param_types) + 1, 2)
142-
)
139+
try:
140+
item_key = tuple(
141+
dk[key + 1]
142+
for key in range(len(params), len(param_types) + 1, 2)
143+
)
144+
except IndexError:
145+
item_key = dk
143146

144147
except Exception as _:
145148
if not ignore_decoding_errors:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "async-substrate-interface"
3-
version = "1.5.2"
3+
version = "1.5.3"
44
description = "Asyncio library for interacting with substrate. Mostly API-compatible with py-substrate-interface"
55
readme = "README.md"
66
license = { file = "LICENSE" }

tests/integration_tests/test_async_substrate_interface.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,3 +161,16 @@ async def test_reconnection():
161161
bh = await substrate.get_chain_finalised_head()
162162
assert isinstance(bh, str)
163163
assert isinstance(await substrate.get_block_number(bh), int)
164+
165+
166+
@pytest.mark.asyncio
167+
async def test_query_map_with_odd_number_of_params():
168+
async with AsyncSubstrateInterface(ARCHIVE_ENTRYPOINT, ss58_format=42) as substrate:
169+
qm = await substrate.query_map(
170+
"SubtensorModule",
171+
"Alpha",
172+
["5CoZxgtfhcJKX2HmkwnsN18KbaT9aih9eF3b6qVPTgAUbifj"],
173+
)
174+
first_record = qm.records[0]
175+
assert len(first_record) == 2
176+
assert len(first_record[0]) == 4

tests/integration_tests/test_substrate_interface.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,15 @@ def test_query_multiple():
100100
storage_function="OwnedHotkeys",
101101
block_hash=block_hash,
102102
)
103+
104+
105+
def test_query_map_with_odd_number_of_params():
106+
with SubstrateInterface(LATENT_LITE_ENTRYPOINT, ss58_format=42) as substrate:
107+
qm = substrate.query_map(
108+
"SubtensorModule",
109+
"Alpha",
110+
["5CoZxgtfhcJKX2HmkwnsN18KbaT9aih9eF3b6qVPTgAUbifj"],
111+
)
112+
first_record = qm.records[0]
113+
assert len(first_record) == 2
114+
assert len(first_record[0]) == 4

0 commit comments

Comments
 (0)