Skip to content
Merged
Changes from 1 commit
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
21 changes: 15 additions & 6 deletions async_substrate_interface/async_substrate.py
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine, but please apply the same logic to sync-substrate aswell.

Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,9 @@ async def process_events(self):
event["event"]["module_id"] == "System"
and event["event"]["event_id"] == "ExtrinsicSuccess"
):
self.__is_success = True
self.__error_message = None
if self.__error_message is None:
self.__is_success = True
self.__error_message = None

if "dispatch_info" in event["event"]["attributes"]:
self.__weight = event["event"]["attributes"]["dispatch_info"][
Expand All @@ -294,13 +295,21 @@ async def process_events(self):
elif (
event["event"]["module_id"] == "System"
and event["event"]["event_id"] == "ExtrinsicFailed"
) or (
event["event"]["module_id"] == "MevShield"
and event["event"]["event_id"] == "DecryptedRejected"
):
self.__is_success = False

dispatch_info = event["event"]["attributes"]["dispatch_info"]
dispatch_error = event["event"]["attributes"]["dispatch_error"]

self.__weight = dispatch_info["weight"]
if event["event"]["module_id"] == "System":
dispatch_info = event["event"]["attributes"]["dispatch_info"]
dispatch_error = event["event"]["attributes"]["dispatch_error"]
self.__weight = dispatch_info["weight"]
else:
# MEV shield extrinsics
dispatch_info = event["event"]["attributes"]["reason"]["post_info"]
dispatch_error = event["event"]["attributes"]["reason"]["error"]
self.__weight = event["event"]["attributes"]["reason"]["post_info"]["actual_weight"]

if "Module" in dispatch_error:
if isinstance(dispatch_error["Module"], tuple):
Expand Down
Loading