@@ -17,13 +17,12 @@ use indexer_tap_agent::{
1717 } ,
1818 sender_allocation:: SenderAllocationMessage ,
1919 } ,
20- test:: { actors:: TestableActor , create_received_receipt, store_batch_receipts} ,
20+ test:: { actors:: TestableActor , create_received_receipt, get_grpc_url , store_batch_receipts} ,
2121} ;
2222use ractor:: { call, concurrency:: JoinHandle , Actor , ActorRef } ;
2323use reqwest:: Url ;
2424use serde_json:: json;
2525use sqlx:: PgPool ;
26- use tap_aggregator:: server:: run_server;
2726use tap_core:: receipt:: { state:: Checking , ReceiptWithState } ;
2827use test_assets:: {
2928 assert_while_retry, flush_messages, ALLOCATION_ID_0 , ALLOCATION_ID_1 , ALLOCATION_ID_2 ,
@@ -34,41 +33,24 @@ use thegraph_core::alloy::primitives::Address;
3433use tokio:: sync:: { watch, Notify } ;
3534use wiremock:: { matchers:: method, Mock , MockServer , ResponseTemplate } ;
3635
37- async fn mock_escrow_subgraph_empty_response ( ) -> MockServer {
38- let mock_ecrow_subgraph_server: MockServer = MockServer :: start ( ) . await ;
39- let _mock_ecrow_subgraph = mock_ecrow_subgraph_server
40- . register ( Mock :: given ( method ( "POST" ) ) . respond_with (
41- ResponseTemplate :: new ( 200 ) . set_body_json ( json ! ( { "data" : {
42- "transactions" : [ ] ,
43- }
44- } ) ) ,
45- ) )
46- . await ;
47- mock_ecrow_subgraph_server
48- }
4936pub async fn start_agent (
5037 pgpool : PgPool ,
5138) -> (
5239 String ,
5340 Arc < Notify > ,
5441 ( ActorRef < SenderAccountsManagerMessage > , JoinHandle < ( ) > ) ,
55- JoinHandle < ( ) > ,
5642) {
57- let escrow_subgraph_mock_server = mock_escrow_subgraph_empty_response ( ) . await ;
43+ let escrow_subgraph_mock_server: MockServer = MockServer :: start ( ) . await ;
44+ escrow_subgraph_mock_server
45+ . register ( Mock :: given ( method ( "POST" ) ) . respond_with (
46+ ResponseTemplate :: new ( 200 ) . set_body_json ( json ! ( { "data" : {
47+ "transactions" : [ ] ,
48+ }
49+ } ) ) ,
50+ ) )
51+ . await ;
5852
5953 let network_subgraph_mock_server = MockServer :: start ( ) . await ;
60- // Start a TAP aggregator server.
61- let ( handle_aggregator, aggregator_endpoint) = run_server (
62- 0 ,
63- TAP_SIGNER . 0 . clone ( ) ,
64- vec ! [ TAP_SIGNER . 1 ] . into_iter ( ) . collect ( ) ,
65- TAP_EIP712_DOMAIN . clone ( ) ,
66- 100 * 1024 ,
67- 100 * 1024 ,
68- 1 ,
69- )
70- . await
71- . unwrap ( ) ;
7254
7355 let ( _escrow_tx, escrow_accounts) = watch:: channel ( EscrowAccounts :: new (
7456 ESCROW_ACCOUNTS_BALANCES . clone ( ) ,
@@ -78,12 +60,10 @@ pub async fn start_agent(
7860
7961 let ( _allocations_tx, indexer_allocations1) = watch:: channel ( INDEXER_ALLOCATIONS . clone ( ) ) ;
8062
81- let sender_aggregator_endpoints: HashMap < _ , _ > = vec ! [ (
82- TAP_SENDER . 1 ,
83- Url :: from_str( & format!( "http://{}" , aggregator_endpoint) ) . unwrap( ) ,
84- ) ]
85- . into_iter ( )
86- . collect ( ) ;
63+ let sender_aggregator_endpoints: HashMap < _ , _ > =
64+ vec ! [ ( TAP_SENDER . 1 , Url :: from_str( & get_grpc_url( ) . await ) . unwrap( ) ) ]
65+ . into_iter ( )
66+ . collect ( ) ;
8767
8868 let http_client = reqwest:: Client :: new ( ) ;
8969
@@ -132,25 +112,18 @@ pub async fn start_agent(
132112 prefix : Some ( prefix. clone ( ) ) ,
133113 } ;
134114
135- // let actorr = SenderAccountsManager::spawn(None, SenderAccountsManager, args)
136- // .await
137- // .expect("Failed to start sender accounts manager actor.");
138- // actorr
139-
140115 let actor = TestableActor :: new ( SenderAccountsManager ) ;
141116 let notify = actor. notify . clone ( ) ;
142117 (
143118 prefix,
144119 notify,
145120 Actor :: spawn ( None , actor, args) . await . unwrap ( ) ,
146- handle_aggregator,
147121 )
148122}
149123
150124#[ sqlx:: test( migrations = "../../migrations" ) ]
151125async fn test_start_tap_agent ( pgpool : PgPool ) {
152- let ( prefix, notify, ( _actor_ref, _handle) , _aggregator_handle) =
153- start_agent ( pgpool. clone ( ) ) . await ;
126+ let ( prefix, notify, ( _actor_ref, _handle) ) = start_agent ( pgpool. clone ( ) ) . await ;
154127 flush_messages ( & notify) . await ;
155128
156129 // verify if create sender account
0 commit comments