@@ -274,14 +274,14 @@ async def process_events(self):
274274 has_transaction_fee_paid_event = True
275275
276276 # Process other events
277+ possible_success = False
277278 for event in await self .triggered_events :
278279 # Check events
279280 if (
280281 event ["event" ]["module_id" ] == "System"
281282 and event ["event" ]["event_id" ] == "ExtrinsicSuccess"
282283 ):
283- self .__is_success = True
284- self .__error_message = None
284+ possible_success = True
285285
286286 if "dispatch_info" in event ["event" ]["attributes" ]:
287287 self .__weight = event ["event" ]["attributes" ]["dispatch_info" ][
@@ -294,13 +294,26 @@ async def process_events(self):
294294 elif (
295295 event ["event" ]["module_id" ] == "System"
296296 and event ["event" ]["event_id" ] == "ExtrinsicFailed"
297+ ) or (
298+ event ["event" ]["module_id" ] == "MevShield"
299+ and event ["event" ]["event_id" ] == "DecryptedRejected"
297300 ):
301+ possible_success = False
298302 self .__is_success = False
299303
300- dispatch_info = event ["event" ]["attributes" ]["dispatch_info" ]
301- dispatch_error = event ["event" ]["attributes" ]["dispatch_error" ]
302-
303- self .__weight = dispatch_info ["weight" ]
304+ if event ["event" ]["module_id" ] == "System" :
305+ dispatch_info = event ["event" ]["attributes" ]["dispatch_info" ]
306+ dispatch_error = event ["event" ]["attributes" ]["dispatch_error" ]
307+ self .__weight = dispatch_info ["weight" ]
308+ else :
309+ # MEV shield extrinsics
310+ dispatch_info = event ["event" ]["attributes" ]["reason" ][
311+ "post_info"
312+ ]
313+ dispatch_error = event ["event" ]["attributes" ]["reason" ]["error" ]
314+ self .__weight = event ["event" ]["attributes" ]["reason" ][
315+ "post_info"
316+ ]["actual_weight" ]
304317
305318 if "Module" in dispatch_error :
306319 if isinstance (dispatch_error ["Module" ], tuple ):
@@ -366,6 +379,10 @@ async def process_events(self):
366379 and event ["event" ]["event_id" ] == "Deposit"
367380 ):
368381 self .__total_fee_amount += event .value ["attributes" ]["amount" ]
382+ if possible_success is True and self .__error_message is None :
383+ # we delay the positive setting of the __is_success flag until we have finished iteration of the
384+ # events and have ensured nothing has set an error message
385+ self .__is_success = True
369386
370387 @property
371388 async def is_success (self ) -> bool :
0 commit comments