Skip to content

Commit b72b7e7

Browse files
committed
Edge case where passing weird number of params vs normal param types could result in valid data received and decoded, but unable to create the map.
1 parent 6bb8302 commit b72b7e7

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

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:

0 commit comments

Comments
 (0)