Skip to content

Commit d7c09cb

Browse files
authored
Merge pull request #247 from opentensor/feat/adds-custom-extrinsic-DecryptionFailed
Update: Adds supp for new extrinsic `DecryptionFailed`
2 parents 3e9bed1 + f3471cb commit d7c09cb

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

async_substrate_interface/async_substrate.py

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,8 @@ async def process_events(self):
297297
and event["event"]["event_id"] == "ExtrinsicFailed"
298298
) or (
299299
event["event"]["module_id"] == "MevShield"
300-
and event["event"]["event_id"] == "DecryptedRejected"
300+
and event["event"]["event_id"]
301+
in ("DecryptedRejected", "DecryptionFailed")
301302
):
302303
possible_success = False
303304
self.__is_success = False
@@ -308,13 +309,23 @@ async def process_events(self):
308309
self.__weight = dispatch_info["weight"]
309310
else:
310311
# MEV shield extrinsics
311-
dispatch_info = event["event"]["attributes"]["reason"][
312-
"post_info"
313-
]
314-
dispatch_error = event["event"]["attributes"]["reason"]["error"]
315-
self.__weight = event["event"]["attributes"]["reason"][
316-
"post_info"
317-
]["actual_weight"]
312+
if event["event"]["event_id"] == "DecryptedRejected":
313+
dispatch_info = event["event"]["attributes"]["reason"][
314+
"post_info"
315+
]
316+
dispatch_error = event["event"]["attributes"]["reason"][
317+
"error"
318+
]
319+
self.__weight = event["event"]["attributes"]["reason"][
320+
"post_info"
321+
]["actual_weight"]
322+
else:
323+
self.__error_message = {
324+
"type": "MevShield",
325+
"name": "DecryptionFailed",
326+
"docs": event["event"]["attributes"]["reason"],
327+
}
328+
continue
318329

319330
if "Module" in dispatch_error:
320331
if isinstance(dispatch_error["Module"], tuple):

0 commit comments

Comments
 (0)