@@ -462,17 +462,11 @@ mod test {
462462 #[ future( awt) ]
463463 context : TapAgentContext < T > ,
464464 ) where
465- T : CreateReceipt ,
465+ T : CreateReceipt < Id = Address > ,
466466 TapAgentContext < T > : ReceiptRead < TapReceipt > + ReceiptDelete ,
467467 {
468- let received_receipt = T :: create_received_receipt (
469- Some ( ALLOCATION_ID_0 ) ,
470- None ,
471- & SIGNER . 0 ,
472- u64:: MAX ,
473- u64:: MAX ,
474- u128:: MAX ,
475- ) ;
468+ let received_receipt =
469+ T :: create_received_receipt ( ALLOCATION_ID_0 , & SIGNER . 0 , u64:: MAX , u64:: MAX , u128:: MAX ) ;
476470
477471 // Storing the receipt
478472 store_receipt ( & context. pgpool , received_receipt. signed_receipt ( ) )
@@ -508,9 +502,16 @@ mod test {
508502 let received_receipt_vec: Vec < _ > = received_receipt_vec
509503 . iter ( )
510504 . filter ( |received_receipt| {
505+ use thegraph_core:: CollectionId ;
506+ let expected_collection_id = * CollectionId :: from ( storage_adapter. allocation_id ) ;
507+
508+ let id_matches = received_receipt. signed_receipt ( ) . allocation_id ( )
509+ == Some ( storage_adapter. allocation_id )
510+ || received_receipt. signed_receipt ( ) . collection_id ( )
511+ == Some ( expected_collection_id) ;
512+
511513 range. contains ( & received_receipt. signed_receipt ( ) . timestamp_ns ( ) )
512- && ( received_receipt. signed_receipt ( ) . allocation_id ( )
513- == Some ( storage_adapter. allocation_id ) )
514+ && id_matches
514515 && escrow_accounts_snapshot
515516 . get_sender_for_signer (
516517 & received_receipt
@@ -579,13 +580,15 @@ mod test {
579580 . zip ( received_receipt_vec. iter ( ) )
580581 . collect :: < Vec < _ > > ( ) ;
581582
582- // Remove the received receipts by timestamp range for the correct (allocation_id ,
583+ // Remove the received receipts by timestamp range for the correct (collection_id ,
583584 // sender)
584585 let received_receipt_vec: Vec < _ > = received_receipt_vec
585586 . iter ( )
586587 . filter ( |( _, received_receipt) | {
587- if ( received_receipt. signed_receipt ( ) . allocation_id ( )
588- == Some ( storage_adapter. allocation_id ) )
588+ use thegraph_core:: CollectionId ;
589+ let expected_collection_id = * CollectionId :: from ( storage_adapter. allocation_id ) ;
590+ if ( received_receipt. signed_receipt ( ) . collection_id ( )
591+ == Some ( expected_collection_id) )
589592 && escrow_accounts_snapshot
590593 . get_sender_for_signer (
591594 & received_receipt
@@ -837,14 +840,13 @@ mod test {
837840 #[ future( awt) ]
838841 context : TapAgentContext < T > ,
839842 ) where
840- T : CreateReceipt ,
843+ T : CreateReceipt < Id = Address > ,
841844 TapAgentContext < T > : ReceiptRead < TapReceipt > + ReceiptDelete ,
842845 {
843846 // Creating 100 receipts with timestamps 42 to 141
844847 for i in 0 ..100 {
845848 let receipt = T :: create_received_receipt (
846- Some ( ALLOCATION_ID_0 ) ,
847- None ,
849+ ALLOCATION_ID_0 ,
848850 & SIGNER . 0 ,
849851 i + 684 ,
850852 i + 42 ,
@@ -870,8 +872,7 @@ mod test {
870872 // add a copy in the same timestamp
871873 for i in 0 ..100 {
872874 let receipt = T :: create_received_receipt (
873- Some ( ALLOCATION_ID_0 ) ,
874- None ,
875+ ALLOCATION_ID_0 ,
875876 & SIGNER . 0 ,
876877 i + 684 ,
877878 i + 43 ,
@@ -906,15 +907,14 @@ mod test {
906907 #[ future( awt) ]
907908 context : TapAgentContext < T > ,
908909 ) where
909- T : CreateReceipt ,
910+ T : CreateReceipt < Id = Address > ,
910911 TapAgentContext < T > : ReceiptRead < TapReceipt > + ReceiptDelete ,
911912 {
912913 // Creating 10 receipts with timestamps 42 to 51
913914 let mut received_receipt_vec = Vec :: new ( ) ;
914915 for i in 0 ..10 {
915916 received_receipt_vec. push ( T :: create_received_receipt (
916- Some ( ALLOCATION_ID_0 ) ,
917- None ,
917+ ALLOCATION_ID_0 ,
918918 & SIGNER . 0 ,
919919 i + 684 ,
920920 i + 42 ,
@@ -923,16 +923,14 @@ mod test {
923923
924924 // Adding irrelevant receipts to make sure they are not retrieved
925925 received_receipt_vec. push ( T :: create_received_receipt (
926- Some ( ALLOCATION_ID_IRRELEVANT ) ,
927- None ,
926+ ALLOCATION_ID_IRRELEVANT ,
928927 & SIGNER . 0 ,
929928 i + 684 ,
930929 i + 42 ,
931930 ( i + 124 ) . into ( ) ,
932931 ) ) ;
933932 received_receipt_vec. push ( T :: create_received_receipt (
934- Some ( ALLOCATION_ID_0 ) ,
935- None ,
933+ ALLOCATION_ID_0 ,
936934 & SENDER_IRRELEVANT . 0 ,
937935 i + 684 ,
938936 i + 42 ,
@@ -1034,15 +1032,14 @@ mod test {
10341032 #[ future( awt) ]
10351033 context : TapAgentContext < T > ,
10361034 ) where
1037- T : CreateReceipt + RemoveRange ,
1035+ T : CreateReceipt < Id = Address > + RemoveRange ,
10381036 TapAgentContext < T > : ReceiptRead < TapReceipt > + ReceiptDelete ,
10391037 {
10401038 // Creating 10 receipts with timestamps 42 to 51
10411039 let mut received_receipt_vec = Vec :: new ( ) ;
10421040 for i in 0 ..10 {
10431041 received_receipt_vec. push ( T :: create_received_receipt (
1044- Some ( ALLOCATION_ID_0 ) ,
1045- None ,
1042+ ALLOCATION_ID_0 ,
10461043 & SIGNER . 0 ,
10471044 i + 684 ,
10481045 i + 42 ,
@@ -1051,16 +1048,14 @@ mod test {
10511048
10521049 // Adding irrelevant receipts to make sure they are not retrieved
10531050 received_receipt_vec. push ( T :: create_received_receipt (
1054- Some ( ALLOCATION_ID_IRRELEVANT ) ,
1055- None ,
1051+ ALLOCATION_ID_IRRELEVANT ,
10561052 & SIGNER . 0 ,
10571053 i + 684 ,
10581054 i + 42 ,
10591055 ( i + 124 ) . into ( ) ,
10601056 ) ) ;
10611057 received_receipt_vec. push ( T :: create_received_receipt (
1062- Some ( ALLOCATION_ID_0 ) ,
1063- None ,
1058+ ALLOCATION_ID_0 ,
10641059 & SENDER_IRRELEVANT . 0 ,
10651060 i + 684 ,
10661061 i + 42 ,
0 commit comments