@@ -639,22 +639,24 @@ async fn test_manager_wrong_aggregator_keys(
639639
640640 let mut counter = 1 ;
641641 for ( receipt_1, id) in requests {
642- let result = client_1. request ( "request" , ( id, receipt_1) ) . await ;
642+ let result: Result < ( ) , jsonrpsee:: core:: Error > =
643+ client_1. request ( "request" , ( id, receipt_1) ) . await ;
643644 // The rav request is being made with messages that have been signed with a key that differs from the gateway aggregator's.
644645 // So the Gateway Aggregator should send an error to the requesting Indexer.
645646 // And so the Indexer should then return an error to the clinet when a rav request is made.
646647 // A rav request is made when the number of receipts sent = receipt_threshold_1.
647648 // result should be an error when counter = multiple of receipt_threshold_1 and Ok otherwise.
648649 if ( counter % receipt_threshold_1) == 0 {
649- match result {
650- Ok ( ( ) ) => panic ! ( "Gateway Aggregator should have sent an error to the Indexer." ) ,
651- Err ( _ ) => { }
652- }
650+ assert ! (
651+ result . is_err ( ) ,
652+ "Gateway Aggregator should have sent an error to the Indexer."
653+ ) ;
653654 } else {
654- match result {
655- Ok ( ( ) ) => { }
656- Err ( e) => panic ! ( "Error making receipt request: {:?}" , e) ,
657- }
655+ assert ! (
656+ result. is_ok( ) ,
657+ "Error making receipt request: {:?}" ,
658+ result. unwrap_err( )
659+ ) ;
658660 }
659661 counter += 1 ;
660662 }
@@ -680,21 +682,20 @@ async fn test_manager_wrong_requestor_keys(
680682
681683 let mut counter = 1 ;
682684 for ( receipt_1, id) in requests {
683- let result = client_1. request ( "request" , ( id, receipt_1) ) . await ;
685+ let result: Result < ( ) , jsonrpsee:: core:: Error > =
686+ client_1. request ( "request" , ( id, receipt_1) ) . await ;
684687 // The receipts have been signed with a key that the Indexer is not expecting.
685688 // So the Indexer should return an error when a rav request is made, because they will not have any valid receipts for the request.
686689 // A rav request is made when the number of receipts sent = receipt_threshold_1.
687690 // result should be an error when counter = multiple of receipt_threshold_1 and Ok otherwise.
688691 if ( counter % receipt_threshold_1) == 0 {
689- match result {
690- Ok ( ( ) ) => panic ! ( "Should have failed signature verification" ) ,
691- Err ( _) => { }
692- }
692+ assert ! ( result. is_err( ) , "Should have failed signature verification" ) ;
693693 } else {
694- match result {
695- Ok ( ( ) ) => { }
696- Err ( e) => panic ! ( "Error making receipt request: {:?}" , e) ,
697- }
694+ assert ! (
695+ result. is_ok( ) ,
696+ "Error making receipt request: {:?}" ,
697+ result. unwrap_err( )
698+ ) ;
698699 }
699700 counter += 1 ;
700701 }
@@ -740,22 +741,21 @@ async fn test_tap_manager_rav_timestamp_cuttoff(
740741
741742 let mut counter = 1 ;
742743 for ( receipt_1, id) in requests {
743- let result = client_1. request ( "request" , ( id, receipt_1) ) . await ;
744+ let result: Result < ( ) , jsonrpsee:: core:: Error > =
745+ client_1. request ( "request" , ( id, receipt_1) ) . await ;
744746
745747 // The first receipt in the second batch has the same timestamp as the last receipt in the first batch.
746748 // TAP manager should ignore this receipt when creating the second RAV request.
747749 // The indexer_mock will throw an error if the number of receipts in RAV request is less than the expected number.
748750 // An error is expected when requesting the second RAV.
749751 if counter == 2 * receipt_threshold_1 {
750- match result {
751- Ok ( ( ) ) => panic ! ( "Should have failed RAV request" ) ,
752- Err ( _) => { }
753- }
752+ assert ! ( result. is_err( ) , "Should have failed RAV request" ) ;
754753 } else {
755- match result {
756- Ok ( ( ) ) => { }
757- Err ( e) => panic ! ( "Error making receipt request: {:?}" , e) ,
758- }
754+ assert ! (
755+ result. is_ok( ) ,
756+ "Error making receipt request: {:?}" ,
757+ result. unwrap_err( )
758+ ) ;
759759 }
760760 counter += 1 ;
761761 }
@@ -796,8 +796,7 @@ async fn test_tap_aggregator_rav_timestamp_cuttoff(
796796 http_max_concurrent_connections,
797797 )
798798 . await ?;
799- let client =
800- HttpClientBuilder :: default ( ) . build ( format ! ( "http://{}" , gateway_addr. to_string( ) ) ) ?;
799+ let client = HttpClientBuilder :: default ( ) . build ( format ! ( "http://{}" , gateway_addr) ) ?;
801800
802801 // This is the first part of the test, two batches of receipts are sent to the aggregator.
803802 // The second batch has one receipt with the same timestamp as the latest receipt in the first batch.
@@ -828,10 +827,10 @@ async fn test_tap_aggregator_rav_timestamp_cuttoff(
828827 jsonrpsee_helpers:: JsonRpcResponse < SignedRAV > ,
829828 jsonrpsee:: core:: Error ,
830829 > = client. request ( "aggregate_receipts" , params) . await ;
831- match second_rav_response {
832- Ok ( _ ) => panic ! ( "Should have failed RAV request" ) ,
833- Err ( _ ) => { }
834- }
830+ assert ! (
831+ second_rav_response . is_err ( ) ,
832+ "Should have failed RAV request"
833+ ) ;
835834
836835 // This is the second part of the test, two batches of receipts are sent to the aggregator.
837836 // The second batch has one receipt with the timestamp = timestamp+1 of the latest receipt in the first batch.
0 commit comments