@@ -344,6 +344,16 @@ where
344
344
finality_proof_info. block_number ,
345
345
) {
346
346
// we only refund relayer if all calls have updated chain state
347
+ log:: trace!(
348
+ target: "runtime::bridge" ,
349
+ "{} from parachain {} via {:?}: failed to refund relayer {:?}, because \
350
+ relay chain finality proof has not been accepted",
351
+ Self :: IDENTIFIER ,
352
+ Para :: Id :: get( ) ,
353
+ Msgs :: Id :: get( ) ,
354
+ relayer,
355
+ ) ;
356
+
347
357
return Ok ( ( ) )
348
358
}
349
359
@@ -366,15 +376,34 @@ where
366
376
para_proof_info,
367
377
) {
368
378
// we only refund relayer if all calls have updated chain state
379
+ log:: trace!(
380
+ target: "runtime::bridge" ,
381
+ "{} from parachain {} via {:?}: failed to refund relayer {:?}, because \
382
+ parachain finality proof has not been accepted",
383
+ Self :: IDENTIFIER ,
384
+ Para :: Id :: get( ) ,
385
+ Msgs :: Id :: get( ) ,
386
+ relayer,
387
+ ) ;
388
+
369
389
return Ok ( ( ) )
370
390
}
371
391
}
372
392
373
- // Check if the `ReceiveMessagesProof` call delivered at least some of the messages that
393
+ // Check if the `ReceiveMessagesProof` call delivered all the messages that
374
394
// it contained. If this happens, we consider the transaction "helpful" and refund it.
375
395
let msgs_call_info = call_info. messages_call_info ( ) ;
376
- if !MessagesCallHelper :: < Runtime , Msgs :: Instance > :: was_partially_successful ( msgs_call_info)
377
- {
396
+ if !MessagesCallHelper :: < Runtime , Msgs :: Instance > :: was_successful ( msgs_call_info) {
397
+ log:: trace!(
398
+ target: "runtime::bridge" ,
399
+ "{} from parachain {} via {:?}: failed to refund relayer {:?}, because \
400
+ some of messages have not been accepted",
401
+ Self :: IDENTIFIER ,
402
+ Para :: Id :: get( ) ,
403
+ Msgs :: Id :: get( ) ,
404
+ relayer,
405
+ ) ;
406
+
378
407
return Ok ( ( ) )
379
408
}
380
409
@@ -1032,6 +1061,30 @@ mod tests {
1032
1061
} ) ;
1033
1062
}
1034
1063
1064
+ #[ test]
1065
+ fn post_dispatch_ignores_transaction_that_has_not_delivered_all_messages ( ) {
1066
+ run_test ( || {
1067
+ initialize_environment ( 200 , 200 , Default :: default ( ) , 150 ) ;
1068
+
1069
+ assert_storage_noop ! ( run_post_dispatch( Some ( all_finality_pre_dispatch_data( ) ) , Ok ( ( ) ) ) ) ;
1070
+ assert_storage_noop ! ( run_post_dispatch(
1071
+ Some ( parachain_finality_pre_dispatch_data( ) ) ,
1072
+ Ok ( ( ) )
1073
+ ) ) ;
1074
+ assert_storage_noop ! ( run_post_dispatch( Some ( delivery_pre_dispatch_data( ) ) , Ok ( ( ) ) ) ) ;
1075
+
1076
+ assert_storage_noop ! ( run_post_dispatch(
1077
+ Some ( all_finality_confirmation_pre_dispatch_data( ) ) ,
1078
+ Ok ( ( ) )
1079
+ ) ) ;
1080
+ assert_storage_noop ! ( run_post_dispatch(
1081
+ Some ( parachain_finality_confirmation_pre_dispatch_data( ) ) ,
1082
+ Ok ( ( ) )
1083
+ ) ) ;
1084
+ assert_storage_noop ! ( run_post_dispatch( Some ( confirmation_pre_dispatch_data( ) ) , Ok ( ( ) ) ) ) ;
1085
+ } ) ;
1086
+ }
1087
+
1035
1088
#[ test]
1036
1089
fn post_dispatch_refunds_relayer_in_all_finality_batch_with_extra_weight ( ) {
1037
1090
run_test ( || {
0 commit comments