Skip to content

Commit 1a093aa

Browse files
committed
Test progress
1 parent 78761b5 commit 1a093aa

File tree

3 files changed

+252
-239
lines changed

3 files changed

+252
-239
lines changed

async_substrate_interface/async_substrate.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,7 +1336,7 @@ async def decode_block(block_data, block_data_hash=None) -> dict[str, Any]:
13361336
]
13371337

13381338
block_author = validator_set[rank_validator]
1339-
block_data["author"] = block_author.value
1339+
block_data["author"] = block_author
13401340

13411341
elif engine == b"aura":
13421342
aura_predigest = (
@@ -1355,7 +1355,7 @@ async def decode_block(block_data, block_data_hash=None) -> dict[str, Any]:
13551355
] % len(validator_set)
13561356

13571357
block_author = validator_set[rank_validator]
1358-
block_data["author"] = block_author.value
1358+
block_data["author"] = block_author
13591359
else:
13601360
raise NotImplementedError(
13611361
f"Cannot extract author for engine {log_digest.value['PreRuntime'][0]}"
@@ -1377,7 +1377,7 @@ async def decode_block(block_data, block_data_hash=None) -> dict[str, Any]:
13771377
block_author = validator_set.elements[
13781378
rank_validator
13791379
]
1380-
block_data["author"] = block_author.value
1380+
block_data["author"] = block_author
13811381
else:
13821382
raise NotImplementedError(
13831383
f"Cannot extract author for engine"

async_substrate_interface/sync_substrate.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from scalecodec import GenericExtrinsic, GenericCall, GenericRuntimeCallDefinition
1010
from scalecodec.base import RuntimeConfigurationObject, ScaleBytes, ScaleType
1111
import ujson
12-
from websockets.sync.client import connect, ClientConnection
12+
from websockets.sync.client import connect
1313

1414
from async_substrate_interface.errors import (
1515
ExtrinsicNotFound,
@@ -502,7 +502,8 @@ def __init__(
502502
self._metadata_cache = {}
503503
self.metadata_version_hex = "0x0f000000" # v15
504504
self.reload_type_registry()
505-
self.initialize()
505+
if not _mock:
506+
self.initialize()
506507

507508
def __enter__(self):
508509
self.initialize()
@@ -1090,7 +1091,7 @@ def decode_block(block_data, block_data_hash=None) -> dict[str, Any]:
10901091
]
10911092

10921093
block_author = validator_set[rank_validator]
1093-
block_data["author"] = block_author.value
1094+
block_data["author"] = block_author
10941095

10951096
elif engine == b"aura":
10961097
aura_predigest = (
@@ -1109,7 +1110,7 @@ def decode_block(block_data, block_data_hash=None) -> dict[str, Any]:
11091110
] % len(validator_set)
11101111

11111112
block_author = validator_set[rank_validator]
1112-
block_data["author"] = block_author.value
1113+
block_data["author"] = block_author
11131114
else:
11141115
raise NotImplementedError(
11151116
f"Cannot extract author for engine {log_digest.value['PreRuntime'][0]}"
@@ -1131,7 +1132,7 @@ def decode_block(block_data, block_data_hash=None) -> dict[str, Any]:
11311132
block_author = validator_set.elements[
11321133
rank_validator
11331134
]
1134-
block_data["author"] = block_author.value
1135+
block_data["author"] = block_author
11351136
else:
11361137
raise NotImplementedError(
11371138
f"Cannot extract author for engine"
@@ -1775,6 +1776,7 @@ def get_chain_head(self) -> str:
17751776
)
17761777
]
17771778
)
1779+
print(1779, result)
17781780
self.last_block_hash = result["rpc_request"][0]["result"]
17791781
return result["rpc_request"][0]["result"]
17801782

@@ -2548,7 +2550,9 @@ def query(
25482550
result_handler=subscription_handler,
25492551
)
25502552
result = responses[preprocessed.queryable][0]
2553+
print(2552, type(result))
25512554
if isinstance(result, (list, tuple, int, float)):
2555+
print("returning ScaleObj")
25522556
return ScaleObj(result)
25532557
return result
25542558

0 commit comments

Comments
 (0)