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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# Changelog
## 1.5.3 /2025-09-16
* edge case query map keys by @thewhaleking in https://github.com/opentensor/async-substrate-interface/pull/186

**Full Changelog**: https://github.com/opentensor/async-substrate-interface/compare/v1.5.2...v1.5.3

## 1.5.2 /2025-09-08
* Improve test workflows by @basfroman in https://github.com/opentensor/async-substrate-interface/pull/173
* Adds env var support for setting cache size by @thewhaleking in https://github.com/opentensor/async-substrate-interface/pull/174
Expand Down
11 changes: 7 additions & 4 deletions async_substrate_interface/utils/decoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,14 @@ def concat_hash_len(key_hasher: str) -> int:
if decode_ss58:
if kts[kts.index(", ") + 2 : kts.index(")")] == "scale_info::0":
item_key = ss58_encode(bytes(item_key[0]), runtime.ss58_format)

else:
item_key = tuple(
dk[key + 1] for key in range(len(params), len(param_types) + 1, 2)
)
try:
item_key = tuple(
dk[key + 1]
for key in range(len(params), len(param_types) + 1, 2)
)
except IndexError:
item_key = dk

except Exception as _:
if not ignore_decoding_errors:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "async-substrate-interface"
version = "1.5.2"
version = "1.5.3"
description = "Asyncio library for interacting with substrate. Mostly API-compatible with py-substrate-interface"
readme = "README.md"
license = { file = "LICENSE" }
Expand Down
13 changes: 13 additions & 0 deletions tests/integration_tests/test_async_substrate_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,16 @@ async def test_reconnection():
bh = await substrate.get_chain_finalised_head()
assert isinstance(bh, str)
assert isinstance(await substrate.get_block_number(bh), int)


@pytest.mark.asyncio
async def test_query_map_with_odd_number_of_params():
async with AsyncSubstrateInterface(ARCHIVE_ENTRYPOINT, ss58_format=42) as substrate:
qm = await substrate.query_map(
"SubtensorModule",
"Alpha",
["5CoZxgtfhcJKX2HmkwnsN18KbaT9aih9eF3b6qVPTgAUbifj"],
)
first_record = qm.records[0]
assert len(first_record) == 2
assert len(first_record[0]) == 4
12 changes: 12 additions & 0 deletions tests/integration_tests/test_substrate_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,15 @@ def test_query_multiple():
storage_function="OwnedHotkeys",
block_hash=block_hash,
)


def test_query_map_with_odd_number_of_params():
with SubstrateInterface(LATENT_LITE_ENTRYPOINT, ss58_format=42) as substrate:
qm = substrate.query_map(
"SubtensorModule",
"Alpha",
["5CoZxgtfhcJKX2HmkwnsN18KbaT9aih9eF3b6qVPTgAUbifj"],
)
first_record = qm.records[0]
assert len(first_record) == 2
assert len(first_record[0]) == 4
Loading