@@ -7,6 +7,7 @@ use std::{
7
7
time:: Duration ,
8
8
} ;
9
9
10
+ use anyhow:: Context ;
10
11
use bigdecimal:: { num_bigint:: ToBigInt , ToPrimitive } ;
11
12
use futures:: { stream, StreamExt } ;
12
13
use indexer_monitor:: { EscrowAccounts , SubgraphClient } ;
@@ -15,19 +16,20 @@ use indexer_query::{
15
16
unfinalized_transactions, UnfinalizedTransactions ,
16
17
} ;
17
18
use indexer_watcher:: watch_pipe;
18
- use jsonrpsee:: http_client:: HttpClientBuilder ;
19
19
use lazy_static:: lazy_static;
20
20
use prometheus:: { register_gauge_vec, register_int_gauge_vec, GaugeVec , IntGaugeVec } ;
21
21
use ractor:: { Actor , ActorProcessingErr , ActorRef , MessagingErr , SupervisionEvent } ;
22
22
use reqwest:: Url ;
23
23
use sqlx:: PgPool ;
24
+ use tap_aggregator:: grpc:: tap_aggregator_client:: TapAggregatorClient ;
24
25
use tap_core:: rav:: SignedRAV ;
25
26
use thegraph_core:: alloy:: {
26
27
hex:: ToHexExt ,
27
28
primitives:: { Address , U256 } ,
28
29
sol_types:: Eip712Domain ,
29
30
} ;
30
31
use tokio:: { sync:: watch:: Receiver , task:: JoinHandle } ;
32
+ use tonic:: transport:: { Channel , Endpoint } ;
31
33
use tracing:: Level ;
32
34
33
35
use super :: sender_allocation:: {
@@ -171,7 +173,7 @@ pub struct State {
171
173
172
174
domain_separator : Eip712Domain ,
173
175
pgpool : PgPool ,
174
- sender_aggregator : jsonrpsee :: http_client :: HttpClient ,
176
+ sender_aggregator : TapAggregatorClient < Channel > ,
175
177
176
178
// Backoff info
177
179
backoff_info : BackoffInfo ,
@@ -603,10 +605,21 @@ impl Actor for SenderAccount {
603
605
. with_label_values ( & [ & sender_id. to_string ( ) ] )
604
606
. set ( config. trigger_value as f64 ) ;
605
607
606
- let sender_aggregator = HttpClientBuilder :: default ( )
607
- . request_timeout ( config. rav_request_timeout )
608
- . build ( & sender_aggregator_endpoint) ?;
608
+ let endpoint = Endpoint :: new ( sender_aggregator_endpoint. to_string ( ) )
609
+ . context ( "Failed to create an endpoint for the sender aggregator" ) ?;
609
610
611
+ let sender_aggregator = TapAggregatorClient :: connect ( endpoint. clone ( ) )
612
+ . await
613
+ . with_context ( || {
614
+ format ! (
615
+ "Failed to connect to the TapAggregator endpoint '{}'" ,
616
+ endpoint. uri( )
617
+ )
618
+ } ) ?;
619
+ // wiremock_grpc used for tests doesn't support Zstd compression
620
+ #[ cfg( not( test) ) ]
621
+ let sender_aggregator =
622
+ sender_aggregator. send_compressed ( tonic:: codec:: CompressionEncoding :: Zstd ) ;
610
623
let state = State {
611
624
prefix,
612
625
sender_fee_tracker : SenderFeeTracker :: new ( config. rav_request_buffer ) ,
@@ -1070,7 +1083,7 @@ pub mod tests {
1070
1083
assert_not_triggered, assert_triggered,
1071
1084
test:: {
1072
1085
actors:: { create_mock_sender_allocation, MockSenderAllocation , TestableActor } ,
1073
- create_rav, store_rav_with_options, INDEXER , TAP_EIP712_DOMAIN_SEPARATOR ,
1086
+ create_rav, get_grpc_url , store_rav_with_options, INDEXER , TAP_EIP712_DOMAIN_SEPARATOR ,
1074
1087
} ,
1075
1088
} ;
1076
1089
@@ -1192,6 +1205,8 @@ pub mod tests {
1192
1205
) )
1193
1206
. expect ( "Failed to update escrow_accounts channel" ) ;
1194
1207
1208
+ // Start a new mock aggregator server for this test
1209
+
1195
1210
let prefix = format ! (
1196
1211
"test-{}" ,
1197
1212
PREFIX_ID . fetch_add( 1 , std:: sync:: atomic:: Ordering :: SeqCst )
@@ -1206,7 +1221,7 @@ pub mod tests {
1206
1221
escrow_subgraph,
1207
1222
network_subgraph,
1208
1223
domain_separator : TAP_EIP712_DOMAIN_SEPARATOR . clone ( ) ,
1209
- sender_aggregator_endpoint : Url :: parse ( DUMMY_URL ) . unwrap ( ) ,
1224
+ sender_aggregator_endpoint : Url :: parse ( & get_grpc_url ( ) . await ) . unwrap ( ) ,
1210
1225
allocation_ids : HashSet :: new ( ) ,
1211
1226
prefix : Some ( prefix. clone ( ) ) ,
1212
1227
retry_interval : RETRY_DURATION ,
0 commit comments