@@ -5,6 +5,7 @@ use crate::verification::InvalidBundleEquivocationError;
5
5
#[ cfg( not( feature = "std" ) ) ]
6
6
use alloc:: vec:: Vec ;
7
7
use codec:: { Decode , Encode } ;
8
+ use core:: fmt;
8
9
use scale_info:: TypeInfo ;
9
10
use sp_consensus_slots:: Slot ;
10
11
use sp_core:: H256 ;
@@ -454,7 +455,7 @@ impl<ReceiptHash> InvalidBundlesFraudProof<ReceiptHash> {
454
455
/// Fraud proof.
455
456
// TODO: Revisit when fraud proof v2 is implemented.
456
457
#[ allow( clippy:: large_enum_variant) ]
457
- #[ derive( Debug , Decode , Encode , TypeInfo , PartialEq , Eq , Clone ) ]
458
+ #[ derive( Decode , Encode , TypeInfo , PartialEq , Eq , Clone ) ]
458
459
pub enum FraudProof < Number , Hash , DomainHeader : HeaderT > {
459
460
InvalidStateTransition ( InvalidStateTransitionProof < HeaderHashFor < DomainHeader > > ) ,
460
461
InvalidTransaction ( InvalidTransactionProof < HeaderHashFor < DomainHeader > > ) ,
@@ -550,6 +551,80 @@ where
550
551
}
551
552
}
552
553
554
+ impl < Number , Hash , DomainHeader : HeaderT > fmt:: Debug for FraudProof < Number , Hash , DomainHeader > {
555
+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
556
+ let domain_id = self . domain_id ( ) ;
557
+ let bad_receipt_hash = self . targeted_bad_receipt_hash ( ) ;
558
+ let bad_operator = self . targeted_bad_operator_and_slot_for_bundle_equivocation ( ) ;
559
+ match self {
560
+ Self :: InvalidStateTransition ( _) => {
561
+ write ! (
562
+ f,
563
+ "InvalidStateTransitionFraudProof({domain_id:?}#{bad_receipt_hash:?})"
564
+ )
565
+ }
566
+ Self :: InvalidTransaction ( _) => {
567
+ write ! (
568
+ f,
569
+ "InvalidTransactionFraudProof({domain_id:?}#{bad_receipt_hash:?})"
570
+ )
571
+ }
572
+ Self :: ImproperTransactionSortition ( _) => {
573
+ write ! (
574
+ f,
575
+ "ImproperTransactionSortitionFraudProof({domain_id:?}#{bad_receipt_hash:?})"
576
+ )
577
+ }
578
+ Self :: BundleEquivocation ( _) => {
579
+ write ! (
580
+ f,
581
+ "BundleEquivocationFraudProof({domain_id:?}#{bad_operator:?})"
582
+ )
583
+ }
584
+ Self :: InvalidExtrinsicsRoot ( _) => {
585
+ write ! (
586
+ f,
587
+ "InvalidExtrinsicsRootFraudProof({domain_id:?}#{bad_receipt_hash:?})"
588
+ )
589
+ }
590
+ Self :: InvalidBlockFees ( _) => {
591
+ write ! (
592
+ f,
593
+ "InvalidBlockFeesFraudProof({domain_id:?}#{bad_receipt_hash:?})"
594
+ )
595
+ }
596
+ Self :: ValidBundle ( _) => {
597
+ write ! (
598
+ f,
599
+ "ValidBundleFraudProof({domain_id:?}#{bad_receipt_hash:?})"
600
+ )
601
+ }
602
+ Self :: InvalidBundles ( _) => {
603
+ write ! (
604
+ f,
605
+ "InvalidBundlesFraudProof({domain_id:?}#{bad_receipt_hash:?})"
606
+ )
607
+ }
608
+ Self :: InvalidDomainBlockHash ( _) => {
609
+ write ! (
610
+ f,
611
+ "InvalidDomainBlockHashFraudProof({domain_id:?}#{bad_receipt_hash:?})"
612
+ )
613
+ }
614
+ Self :: InvalidTransfers ( _) => {
615
+ write ! (
616
+ f,
617
+ "InvalidTransfersFraudProof({domain_id:?}#{bad_receipt_hash:?})"
618
+ )
619
+ }
620
+ #[ cfg( any( feature = "std" , feature = "runtime-benchmarks" ) ) ]
621
+ Self :: Dummy { .. } => {
622
+ write ! ( f, "DummyFraudProof({domain_id:?}#{bad_receipt_hash:?})" )
623
+ }
624
+ }
625
+ }
626
+ }
627
+
553
628
/// Proves an invalid state transition by challenging the trace at specific index in a bad receipt.
554
629
#[ derive( Debug , Decode , Encode , TypeInfo , PartialEq , Eq , Clone ) ]
555
630
pub struct InvalidStateTransitionProof < ReceiptHash > {
0 commit comments