Skip to content

Commit c0db16a

Browse files
author
µ
committed
async_substrate.py: drop _first_init_runtime()
1 parent 307fc71 commit c0db16a

File tree

1 file changed

+10
-25
lines changed

1 file changed

+10
-25
lines changed

async_substrate_interface/async_substrate.py

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ async def initialize(self):
728728
chain = await self.rpc_request("system_chain", [])
729729
self._chain = chain.get("result")
730730
init_load = await asyncio.gather(
731-
self._first_initialize_runtime(),
731+
self.init_runtime(),
732732
return_exceptions=True,
733733
)
734734
for potential_exception in init_load:
@@ -899,30 +899,6 @@ async def decode_scale(
899899
else:
900900
return obj
901901

902-
async def _first_initialize_runtime(self):
903-
"""
904-
TODO docstring
905-
"""
906-
runtime_info, metadata, metadata_v15 = await asyncio.gather(
907-
self.get_block_runtime_info(None),
908-
self.get_block_metadata(),
909-
self._load_registry_at_block(None)
910-
)
911-
await self.load_runtime(
912-
runtime_info = runtime_info,
913-
metadata = metadata,
914-
metadata_v15 = metadata_v15,
915-
registry = self.registry
916-
)
917-
918-
# Check and apply runtime constants
919-
ss58_prefix_constant = await self.get_constant(
920-
"System", "SS58Prefix", block_hash=block_hash
921-
)
922-
923-
if ss58_prefix_constant:
924-
self.ss58_format = ss58_prefix_constant
925-
926902
async def load_runtime(self,runtime_info=None,metadata=None,metadata_v15=None,registry=None):
927903
# Update type registry
928904
self.reload_type_registry(use_remote_preset=False, auto_discover=True)
@@ -1033,6 +1009,15 @@ async def init_runtime(
10331009
registry=runtime.registry,
10341010
)
10351011

1012+
if self.ss58_format is None:
1013+
# Check and apply runtime constants
1014+
ss58_prefix_constant = await self.get_constant(
1015+
"System", "SS58Prefix", block_hash=block_hash
1016+
)
1017+
1018+
if ss58_prefix_constant:
1019+
self.ss58_format = ss58_prefix_constant
1020+
10361021
async def create_storage_key(
10371022
self,
10381023
pallet: str,

0 commit comments

Comments
 (0)