@@ -517,10 +517,6 @@ mod test {
517
517
}
518
518
}
519
519
520
- fn to_hex_string < T : ToHex > ( val : T ) -> String {
521
- format ! ( "0x{}" , val. encode_hex:: <String >( ) )
522
- }
523
-
524
520
#[ tokio:: test]
525
521
async fn test_history_return_correct_logs ( ) {
526
522
let history = History :: new_in_memory ( ) . await . unwrap ( ) ;
@@ -570,7 +566,19 @@ mod test {
570
566
571
567
let logs = history
572
568
. query ( )
573
- . search ( to_hex_string ( status. request_tx_hash ) )
569
+ . search ( status. request_tx_hash . encode_hex ( ) )
570
+ . unwrap ( )
571
+ . execute ( )
572
+ . await
573
+ . unwrap ( ) ;
574
+ assert_eq ! ( logs, vec![ status. clone( ) ] ) ;
575
+
576
+ let logs = history
577
+ . query ( )
578
+ . search ( format ! (
579
+ "0x{}" ,
580
+ status. request_tx_hash. encode_hex:: <String >( )
581
+ ) )
574
582
. unwrap ( )
575
583
. execute ( )
576
584
. await
@@ -579,7 +587,28 @@ mod test {
579
587
580
588
let logs = history
581
589
. query ( )
582
- . search ( to_hex_string ( status. request_tx_hash ) )
590
+ . search ( status. request_tx_hash . encode_hex :: < String > ( ) . to_uppercase ( ) )
591
+ . unwrap ( )
592
+ . execute ( )
593
+ . await
594
+ . unwrap ( ) ;
595
+ assert_eq ! ( logs, vec![ status. clone( ) ] ) ;
596
+
597
+ let logs = history
598
+ . query ( )
599
+ . search ( format ! (
600
+ "0x{}" ,
601
+ status. request_tx_hash. encode_hex:: <String >( ) . to_uppercase( )
602
+ ) )
603
+ . unwrap ( )
604
+ . execute ( )
605
+ . await
606
+ . unwrap ( ) ;
607
+ assert_eq ! ( logs, vec![ status. clone( ) ] ) ;
608
+
609
+ let logs = history
610
+ . query ( )
611
+ . search ( status. request_tx_hash . encode_hex ( ) )
583
612
. unwrap ( )
584
613
. state ( StateTag :: Completed )
585
614
. execute ( )
@@ -589,7 +618,7 @@ mod test {
589
618
590
619
let logs = history
591
620
. query ( )
592
- . search ( to_hex_string ( reveal_tx_hash) )
621
+ . search ( reveal_tx_hash. encode_hex ( ) )
593
622
. unwrap ( )
594
623
. execute ( )
595
624
. await
@@ -598,7 +627,37 @@ mod test {
598
627
599
628
let logs = history
600
629
. query ( )
601
- . search ( to_hex_string ( reveal_tx_hash) )
630
+ . search ( format ! ( "0x{}" , reveal_tx_hash. encode_hex:: <String >( ) ) )
631
+ . unwrap ( )
632
+ . execute ( )
633
+ . await
634
+ . unwrap ( ) ;
635
+ assert_eq ! ( logs, vec![ status. clone( ) ] ) ;
636
+
637
+ let logs = history
638
+ . query ( )
639
+ . search ( reveal_tx_hash. encode_hex :: < String > ( ) . to_uppercase ( ) )
640
+ . unwrap ( )
641
+ . execute ( )
642
+ . await
643
+ . unwrap ( ) ;
644
+ assert_eq ! ( logs, vec![ status. clone( ) ] ) ;
645
+
646
+ let logs = history
647
+ . query ( )
648
+ . search ( format ! (
649
+ "0x{}" ,
650
+ reveal_tx_hash. encode_hex:: <String >( ) . to_uppercase( )
651
+ ) )
652
+ . unwrap ( )
653
+ . execute ( )
654
+ . await
655
+ . unwrap ( ) ;
656
+ assert_eq ! ( logs, vec![ status. clone( ) ] ) ;
657
+
658
+ let logs = history
659
+ . query ( )
660
+ . search ( reveal_tx_hash. encode_hex ( ) )
602
661
. unwrap ( )
603
662
. state ( StateTag :: Completed )
604
663
. execute ( )
@@ -608,7 +667,40 @@ mod test {
608
667
609
668
let logs = history
610
669
. query ( )
611
- . search ( to_hex_string ( status. sender ) )
670
+ . search ( status. sender . encode_hex ( ) )
671
+ . unwrap ( )
672
+ . network_id ( status. network_id )
673
+ . execute ( )
674
+ . await
675
+ . unwrap ( ) ;
676
+ assert_eq ! ( logs, vec![ status. clone( ) ] ) ;
677
+
678
+ let logs = history
679
+ . query ( )
680
+ . search ( format ! ( "0x{}" , status. sender. encode_hex:: <String >( ) ) )
681
+ . unwrap ( )
682
+ . network_id ( status. network_id )
683
+ . execute ( )
684
+ . await
685
+ . unwrap ( ) ;
686
+ assert_eq ! ( logs, vec![ status. clone( ) ] ) ;
687
+
688
+ let logs = history
689
+ . query ( )
690
+ . search ( status. sender . encode_hex :: < String > ( ) . to_uppercase ( ) )
691
+ . unwrap ( )
692
+ . network_id ( status. network_id )
693
+ . execute ( )
694
+ . await
695
+ . unwrap ( ) ;
696
+ assert_eq ! ( logs, vec![ status. clone( ) ] ) ;
697
+
698
+ let logs = history
699
+ . query ( )
700
+ . search ( format ! (
701
+ "0x{}" ,
702
+ status. sender. encode_hex:: <String >( ) . to_uppercase( )
703
+ ) )
612
704
. unwrap ( )
613
705
. network_id ( status. network_id )
614
706
. execute ( )
@@ -618,7 +710,7 @@ mod test {
618
710
619
711
let logs = history
620
712
. query ( )
621
- . search ( to_hex_string ( status. sender ) )
713
+ . search ( status. sender . encode_hex ( ) )
622
714
. unwrap ( )
623
715
. execute ( )
624
716
. await
@@ -627,7 +719,7 @@ mod test {
627
719
628
720
let logs = history
629
721
. query ( )
630
- . search ( to_hex_string ( status. sender ) )
722
+ . search ( status. sender . encode_hex ( ) )
631
723
. unwrap ( )
632
724
. state ( StateTag :: Completed )
633
725
. execute ( )
@@ -662,7 +754,7 @@ mod test {
662
754
663
755
let logs = history
664
756
. query ( )
665
- . search ( to_hex_string ( reveal_tx_hash) )
757
+ . search ( reveal_tx_hash. encode_hex ( ) )
666
758
. unwrap ( )
667
759
. execute ( )
668
760
. await
@@ -682,7 +774,7 @@ mod test {
682
774
History :: update_request_status ( & history. pool , status. clone ( ) ) . await ;
683
775
let logs = history
684
776
. query ( )
685
- . search ( to_hex_string ( status. request_tx_hash ) )
777
+ . search ( status. request_tx_hash . encode_hex ( ) )
686
778
. unwrap ( )
687
779
. execute ( )
688
780
. await
@@ -738,7 +830,7 @@ mod test {
738
830
739
831
let logs = history
740
832
. query ( )
741
- . search ( to_hex_string ( TxHash :: zero ( ) ) )
833
+ . search ( TxHash :: zero ( ) . encode_hex ( ) )
742
834
. unwrap ( )
743
835
. execute ( )
744
836
. await
@@ -747,7 +839,7 @@ mod test {
747
839
748
840
let logs = history
749
841
. query ( )
750
- . search ( to_hex_string ( Address :: zero ( ) ) )
842
+ . search ( Address :: zero ( ) . encode_hex ( ) )
751
843
. unwrap ( )
752
844
. network_id ( status. network_id )
753
845
. execute ( )
@@ -757,7 +849,7 @@ mod test {
757
849
758
850
let logs = history
759
851
. query ( )
760
- . search ( to_hex_string ( Address :: zero ( ) ) )
852
+ . search ( Address :: zero ( ) . encode_hex ( ) )
761
853
. unwrap ( )
762
854
. execute ( )
763
855
. await
0 commit comments