@@ -235,14 +235,14 @@ def process_events(self):
235235 has_transaction_fee_paid_event = True
236236
237237 # Process other events
238+ possible_success = False
238239 for event in self .triggered_events :
239240 # Check events
240241 if (
241242 event ["event" ]["module_id" ] == "System"
242243 and event ["event" ]["event_id" ] == "ExtrinsicSuccess"
243244 ):
244- self .__is_success = True
245- self .__error_message = None
245+ possible_success = True
246246
247247 if "dispatch_info" in event ["event" ]["attributes" ]:
248248 self .__weight = event ["event" ]["attributes" ]["dispatch_info" ][
@@ -255,13 +255,26 @@ def process_events(self):
255255 elif (
256256 event ["event" ]["module_id" ] == "System"
257257 and event ["event" ]["event_id" ] == "ExtrinsicFailed"
258+ ) or (
259+ event ["event" ]["module_id" ] == "MevShield"
260+ and event ["event" ]["event_id" ] == "DecryptedRejected"
258261 ):
262+ possible_success = False
259263 self .__is_success = False
260264
261- dispatch_info = event ["event" ]["attributes" ]["dispatch_info" ]
262- dispatch_error = event ["event" ]["attributes" ]["dispatch_error" ]
263-
264- self .__weight = dispatch_info ["weight" ]
265+ if event ["event" ]["module_id" ] == "System" :
266+ dispatch_info = event ["event" ]["attributes" ]["dispatch_info" ]
267+ dispatch_error = event ["event" ]["attributes" ]["dispatch_error" ]
268+ self .__weight = dispatch_info ["weight" ]
269+ else :
270+ # MEV shield extrinsics
271+ dispatch_info = event ["event" ]["attributes" ]["reason" ][
272+ "post_info"
273+ ]
274+ dispatch_error = event ["event" ]["attributes" ]["reason" ]["error" ]
275+ self .__weight = event ["event" ]["attributes" ]["reason" ][
276+ "post_info"
277+ ]["actual_weight" ]
265278
266279 if "Module" in dispatch_error :
267280 if isinstance (dispatch_error ["Module" ], tuple ):
@@ -319,6 +332,10 @@ def process_events(self):
319332 and event ["event" ]["event_id" ] == "Deposit"
320333 ):
321334 self .__total_fee_amount += event .value ["attributes" ]["amount" ]
335+ if possible_success is True and self .__error_message is None :
336+ # we delay the positive setting of the __is_success flag until we have finished iteration of the
337+ # events and have ensured nothing has set an error message
338+ self .__is_success = True
322339
323340 @property
324341 def is_success (self ) -> bool :
0 commit comments